← All questions
Coding
Reverse Nodes in K Group
Asked at
DoorDash
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Use a dummy predecessor
- 02Find the kth node before mutation
- 03Leave an incomplete suffix unchanged
- 04Reverse the k-node interval
- 05Reconnect head and tail
Reference answer
Then expect these follow-ups
Why does the dummy node simplify the first group?
Tests: correctness reasoning
Which node becomes groupPrev after a reversal?
Tests: follow-up reasoning
Free to read · better with Enzo
Practice this out loud with Enzo
Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.
Next question