DeepOffer

Reverse a linked list.

ML CodingReported interview question
Reported in interviews — Meta (trending 5 months ago, Oct 2026)

Walk the list while storing next, redirect current.next to prev, then advance prev and current. Return prev after O(n) time and O(1) extra space.

Test empty input, one-element input, duplicates, boundary indices, invalid states, and the largest allowed size; state time and space complexity.

Common follow-up questions

Practice this question with an AI interviewer

Get asked follow-ups live, then receive a scored report — like a real MLE interview loop.

Start AI mock interview