FastPrepReverse a Singly Linked List
Problems/Reverse a Singly Linked List

Reverse a Singly Linked List

Expedia logoExpedia● EasyINTERNPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three Expedia intern write-ups name this task and give nothing beyond its name. An anonymous entry about a campus process in September 2022 places it in the first of three video calls held on one day. A post from 2019, about campus hiring for the 2020 internship, has it as the opening problem of the first technical interview. An entry listed in February 2014, for a United States intern role, says it came up in the single interview that followed a career fair visit.

None of them gives an input format, examples or limits. Here, you get the first node of a singly linked list and return the first node of the reversed list. A list has 0 to 1000 nodes (an empty list gives back null), and each value is a whole number from -10^5 to 10^5. Only the returned list is checked.

Our version is about 95% the same as the reported questions.

You are given head, the first node of a singly linked list. Reverse the list and return the first node of the reversed list.

After the reversal, the old last node is the new first node, every link points the other way, and the old first node is the new last node. If the list is empty, head is null and you return null.

Function

reverseList(head: ListNode) → ListNode

Examples

Example 1

head = [7,3,9,2]return = [2,9,3,7]
head
7392
→
return
2937
Moved or new

The list is 7 -> 3 -> 9 -> 2. Read from the last node back to the first, the values are 2, 9, 3, 7, so the new head holds 2.

Example 2

head = [4,4,-1]return = [-1,4,4]
head
44-1
→
return
-144
Moved or new

Values may repeat. The last node holds -1, so it becomes the new head, followed by the two nodes that hold 4.

Example 3

head = [10]return = [10]
head
10
→
return
10

A list with one node is the same when reversed.

Constraints

  • 0 <= n <= 1000, where n is the number of nodes.
  • Every node value is between -10^5 and 10^5.
  • Values may repeat.

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Reverse a Linked ListCisco · PHONE SCREENCisco interview questions
  • Reverse a Linked ListApple · PHONE SCREENApple interview questions
  • Reverse a Singly Linked ListChubb · PHONE SCREENChubb interview questions
  • Reverse a Singly Linked ListMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Reverse a Singly Linked ListAdobe · PHONE SCREENAdobe interview questions
  • Remove Linked List ElementsBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Merge Two Sorted Linked ListsNutanix · PHONE SCREENNutanix interview questions
  • Reverse a Singly Linked ListSuperhuman · PHONE SCREENSuperhuman interview questions
  • Merge K Sorted Linked ListsBharatPe · PHONE SCREEN
  • Sorted Doubly Linked List to Balanced BST In PlaceSalesforce · ONSITE INTERVIEWSalesforce interview questions

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode reverseList(ListNode head) {
        // Write your code here.
    }
}
Checking account…