Interleave Route Stops From Both Ends of a Linked List

Last updated: November 29, 2026

Quick Overview

Given a singly linked list of stops L0 -> L1 -> ... -> Ln, reorder it in place to L0 -> Ln -> L1 -> Ln-1 -> ..., for example to alternate a courier between nearby and far drop-offs. Return nothing; modify the list.

Uber
Coding & Algorithms
Software Engineer
Uber
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given a singly linked list of stops L0 -> L1 -> ... -> Ln, reorder it in place to L0 -> Ln -> L1 -> Ln-1 -> ..., for example to alternate a courier between nearby and far drop-offs. Return nothing; modify the list.

An Uber technical screen linked list problem that combines three primitives: find the middle, reverse a list, and merge two lists. The interviewer checks that you can compose them without an extra array and without creating a cycle.

What the Interviewer Expects
  • Finds the middle with slow and fast pointers
  • Splits the list and terminates the first half
  • Reverses the second half in place
  • Merges alternately
  • Discusses the O(n) array baseline and why O(1) space is better
Key Topics to Cover
Linked lists
Fast and slow pointers
List reversal
Merging
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you undo this reordering?
  • What if you need L0 -> Ln -> Ln-1 -> L1 instead?
  • How would you do this on a doubly linked list?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: head of a singly linked list, possibly empty. Output: none, the list is rewired in place. O(1) extra space required, so copying nodes into an array is only a baseline....

High-Level Design

Step 1: slow and fast pointers stop slow at the end of the first half (for even lengths, the first middle). Step 2: cut after slow and reverse the second half. Step 3: merge, taking one node from the ...


Submit Your Answer
Markdown supported