Reported July 2026
Superhumanlinked list

Deep Copy a Singly Linked List

Reported by candidates from Superhuman's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Superhuman OA. Under 2s to a working solution.
Founder's read

This Superhuman OA, reported in July 2026, looks like a linked list puzzle but it's really a copy-then-mutate check. Build a new list node by node, then change one value in the original and prove the copy didn't move. If you've got an invite for the next day or two, this is one of the gentler ones. The pattern is linked-list traversal with a dummy head, and the whole thing runs in one pass. If you blank on the pointer wiring during the live OA, StealthCoder is the safety net sitting invisibly on your screen.

The problem

Given the head head of a singly linked list, create a deep copy whose nodes share no identity with the original list.
For this exercise, after the copy is complete, change the value of the original node at zero-based position mutationIndex to newValue. Return an array containing two heads in this order:
the mutated original list;
the independent copy, which must still contain every value from before the mutation.

Function
copyAndMutateList(head: ListNode, mutationIndex: int, newValue: int) → ListNode[]

Examples
Example 1
head = [4,7,9]
mutationIndex = 1
newValue = 70
return = [[4,70,9],[4,7,9]]
The value 7 in the original becomes 70. The copied list keeps 7, proving that its nodes are independent.
Example 2
head = [5]
mutationIndex = 0
newValue = -5
return = [[-5],[5]]
Mutating the only original node does not change the one-node copy.
Example 3
head = [1,1,2,1]
mutationIndex = 3
newValue = 8
return = [[1,1,2,8],[1,1,2,1]]
Repeated values do not affect node identity. Only the last original node changes.

Constraints
1 <= number of nodes <= 10^4.
0 <= mutationIndex < number of nodes.
-10^9 <= node.val, newValue <= 10^9.
The input list is finite and contains no cycle.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: there are no random pointers, so a deep copy is just a walk. Create a dummy node, keep a tail pointer, and for each original node append a new ListNode with the same value. That gives O(n) time and O(n) space. Then walk the original to mutationIndex and overwrite its val with newValue. Do the copy first. The classic pitfall is mutating before copying, or reusing original nodes in the copy so the change leaks through. Another slip is returning the dummy instead of dummy.next. Also check the return order: mutated original first, copy second. Example 3 has repeated values, so don't try to match nodes by value. Position is the only thing that matters. If the pointer wiring slips under pressure, StealthCoder can give you the clean loop in the live OA.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Deep Copy a Singly Linked List cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Superhuman's OA.

Superhuman reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Deep Copy a Singly Linked List FAQ

How hard is the Superhuman deep copy linked list question really?+

Easy. There are no random pointers or cycles, so it's a single traversal that builds new nodes. The only real work is keeping the copy independent and returning both heads in the right order. Most candidates finish it fast if they stay calm.

What's the trick to this problem?+

Allocate a brand new ListNode for every original node using a dummy head and a tail pointer. Copy values only, never reuse original nodes. Mutate the original after the copy is done, and the copy stays untouched automatically.

What mistakes fail test cases here?+

Mutating before copying, sharing nodes between lists, returning dummy instead of dummy.next, and swapping the return order. Off-by-one errors on mutationIndex also show up, especially with a single-node list like [5].

Do I need a hash map for this?+

No. A hash map of old to new nodes matters when nodes have random pointers. Here each node has only a next pointer, so a simple forward walk with a tail pointer is enough and uses no extra structure.

How do I prepare for this in 48 hours?+

Write the dummy-head append loop from memory until it's automatic. Then practice walking to index k and editing a value. Test with a one-node list and with repeated values like [1,1,2,1] so you trust node identity over value.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Superhuman.

OA at Superhuman?
Invisible during screen share
Get it