FastPrepRemove Repeated Values from a Sorted List
Problems/Remove Repeated Values from a Sorted List

Remove Repeated Values from a Sorted List

Expedia logoExpedia● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names Remove Duplicates from Sorted List II: delete entire groups of repeated values. We chose the limits and how the result is checked. Our version is about 99% the same as the reported question.

Given a sorted linked list, remove every node whose value occurs more than once. Keep only values that occur exactly once, in their original order, and return the remaining head.

A repeated group is removed entirely; do not keep one representative. Return null, serialized as [], when no node remains.

Function

removeRepeatedValues(head: ListNode) → ListNode

Examples

Example 1

head = [1,2,3,3,4,4,5]return = [1,2,5]
head
1233445
Removed
→
return
125
Moved or new

Both 3 nodes and both 4 nodes are removed.

Example 2

head = [1,1,1,2,3]return = [2,3]
head
11123
Removed
→
return
23
Moved or new

All three 1 nodes are removed, including the old head.

Constraints

  • 0 <= head.length <= 500.
  • -1000000000 <= head[i] <= 1000000000.
  • The input is an acyclic linked list in nondecreasing value order.

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

  • Remove Nth Node From End of ListDruva · ONSITE INTERVIEW
  • Find the Entry of a Linked List CycleQualys · ONSITE INTERVIEWQualys interview questions
  • Detect a Linked-List CyclePaytm · ONSITE INTERVIEWPaytm interview questions
  • Detect a Linked-List CycleCapgemini · ONSITE INTERVIEWCapgemini interview questions
  • Rearrange a Linked List from Alternating EndsConcentric AI · ONSITE INTERVIEWConcentric AI interview questions
  • Palindrome Linked List with RestorationMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Linked List Cycle Entry NodeGoogle · ONSITE INTERVIEWGoogle interview questions
  • Detect and Break a Linked-List CycleAmazon · ONSITE INTERVIEW
  • Odd-Even Linked ListBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Find the Entry of a Linked List CyclePeopleStrong · ONSITE INTERVIEWPeopleStrong interview questions

Interview reports that mention this question

  • Expedia New Grad SDE Oldest Loops: 4 Experiences (Part 3 of 3)

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)
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 removeRepeatedValues(ListNode head) {
        // Write your code here.
    }

}
Checking account…