← All questions
Coding
Reverse Nodes in k-Group
Asked at
Agoda
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 head and group predecessor
- 02Find the kth node before reversing
- 03Leave an incomplete group intact
- 04Reverse nodes within the group boundary
- 05Reconnect predecessor, tail, and next group
Reference answer
Then expect these follow-ups
How would you write the recursive form?
Tests: follow-up reasoning
Why does prev begin at groupNext?
Tests: correctness reasoning
Hiring now
Agoda has 245 open roles right now
landed applies to roles like these for you, on each company’s own site, with answers written for the role.
Get 5x interviews10 free auto-applies. No card.
Customer Experience Specialist - Graveyard Shift (Kuala Lumpur)
Kuala Lumpur, Malaysia
Payment disputes coordinator (10-month contract) (Bangkok-Based, No Visa Provided)
Bangkok, Thailand
Payment Operations Coordinator (10-month contract) (Bangkok-Based, No Visa Provided)
Bangkok, Thailand
Next question