← Microsoft Interview Insights

Microsoft·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Microsoft SWE interview with a classic linked list reversal problem. Nothing too wild, but the follow-up asking for both iterative and recursive solutions is where things got interesting.

Questions Asked (1)

Q1

Given the head of a singly linked list, reverse it and return the new head. Then solve it both iteratively and recursively.

Algorithms & Data Structures
Author's notes

The iterative version came out fine, three pointers, prev/curr/next, pretty mechanical once you've done it a few times.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and edge cases, then walk through the iterative solution with pointer manipulation, followed by the recursive solution. Emphasize time and space complexity for both approaches and discuss trade-offs.

Pro tip: Mention that the recursive solution uses O(n) stack space, which can cause stack overflow for large lists, while the iterative solution is O(1) space. This shows awareness of practical constraints.

1. Clarify and Edge Cases

Confirm the problem: reverse a singly linked list and return new head. Discuss edge cases: empty list, single node, two nodes.

2. Iterative Approach

Explain using three pointers: prev, curr, next. Iterate through list, reversing pointers, until curr is null. Return prev as new head.

3. Recursive Approach

Base case: if head is null or head.next is null, return head. Recursively reverse the rest, then adjust pointers: head.next.next = head; head.next = null. Return new head from recursion.

4. Complexity Analysis

State time complexity O(n) for both. Space: iterative O(1), recursive O(n) due to call stack.

5. Trade-offs and Testing

Discuss when to prefer iterative (memory constraints) vs recursive (simplicity). Mention testing with edge cases and potential follow-ups like reversing in groups.

Key Points to Mention

  • Pointer manipulation: prev, curr, next
  • Base case for recursion
  • Time complexity O(n)
  • Space complexity: iterative O(1), recursive O(n)
  • Edge cases: empty list, single node
  • Stack overflow risk in recursion

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.