← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Phone screen for a senior SWE role at Meta, second problem in the loop was a classic linked-list question. Nothing shocking but the bar for explanation clarity felt higher than I expected.

Questions Asked (1)

Q1

Given the head of a singly-linked list and an integer n, remove the nth node from the end of the list in a single pass and return the modified head.

Algorithms & Data Structures
Author's notes

I knew the two-pointer trick going in, but I fumbled explaining the invariant out loud.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a two-pointer technique with a dummy node to handle edge cases. Advance the fast pointer n+1 steps ahead, then move both pointers until fast reaches the end. The slow pointer will be just before the node to remove, allowing you to delete it in one pass.

Pro tip: Always use a dummy node pointing to the head to simplify removal of the head node and avoid separate edge case handling. Also, clarify with the interviewer whether n is guaranteed to be valid, and discuss time/space complexity upfront.

1. Clarify and Edge Cases

Ask if n is always valid (1 ≤ n ≤ length) and if the list can be empty. Mention edge cases like removing the head or the only node.

2. Set Up Dummy Node and Pointers

Create a dummy node pointing to head. Initialize two pointers (slow and fast) to the dummy node.

3. Advance Fast Pointer

Move the fast pointer n+1 steps forward. This creates a gap of n nodes between slow and fast.

4. Move Both Pointers

Move both slow and fast pointers one step at a time until fast reaches null. Now slow is just before the node to remove.

5. Remove Node and Return

Update slow.next to skip the target node. Return dummy.next as the new head.

Key Points to Mention

  • Two-pointer technique for single-pass traversal
  • Use of dummy node to handle edge cases (e.g., removing head)
  • Time complexity O(L) where L is list length, space O(1)
  • Maintaining a gap of n nodes between pointers
  • Handling n=1 (removing last node) and n=length (removing head)
  • Returning the correct head (dummy.next)

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