Sign In
You are coding as a Guest. Sign in with your RoleNest account to permanently track your streak, earn XP, and climb the Campus Leaderboard!
Sign In with RoleNest
🔥Structured Deep Clone (State Immutability)Medium
DAILY PROBLEM OF THE DAY+50 XP • Daily Streak

Solve today's challenge or tackle one of the 3 Super Hard challenges for +150 XP.

MediumWeb Engineering•Acceptance: 59.3%

Structured Deep Clone (State Immutability)

Targeted in FAANG & Tech OA:GoogleAmazonMicrosoftSwiggyUber
Real-World Engineering Context
Essential for predictable React Redux/Zustand state immutability, undo-redo histories, and form drafts.
Given a JSON-compatible nested dictionary/object `obj`, implement a deep clone that produces an independent copy. Mutating the clone must never affect the original.

Sample Test Cases

Input: [{"a":1,"b":[2,3]}]
Expected: {"a":1,"b":[2,3]}
Input: [{"user":{"name":"Alex","roles":["admin"]}}]
Expected: {"user":{"name":"Alex","roles":["admin"]}}

Constraints

  • Object contains only primitive types, lists, and dicts.
Recruiter Fast-Track ReferralVerified Candidate
Direct pipeline to Google, Amazon, Microsoft, Swiggy, & Uber recruiters
DevScore: 750/1000

Top DevScore profiles bypass resume screening filters. Every verified problem solve writes authentic proof-of-work to your profile and dispatches you directly into employer inboxes on RoleNest.