Delete a Key from a Circular List
Updated
Problem statement
values records one complete traversal of a circular singly linked list from its head. All values are distinct. Delete the node whose value equals key, if present.
Preserve the original head when it survives. If the head is deleted, its old successor becomes the new head. If the only node is deleted, the result is empty. An absent key leaves the order and head unchanged.
Return one complete traversal from the resulting head. Use [] for an empty list.
Function
deleteCircularKey(values: int[], key: int) → int[]Examples
Example 1
values = [2,5,7]key = 5return = [2,7]Unlink the middle node 5 and keep head 2.
Example 2
values = [2,5,7]key = 2return = [5,7]The old head is deleted, so its successor 5 becomes the new head.
Constraints
0 <= values.length <= 2000.-1000000000 <= values[i], key <= 1000000000.- All stored node values are distinct.
More Expedia Online Assessment questions
- Balanced NumbersOA · Seen Aug 2026
- REST API: Discounted PriceOA · Seen Aug 2026
- Maximum Team SizeOA · Seen Mar 2026
- Per-Domain Request LimiterOA · Seen Oct 2025
- Count Equal-Frequency SubsequencesOA · Seen Mar 2025
- Count Increasing Stock PeriodsOA · Seen Mar 2025
- Get Minimum StepsOA · Seen Oct 2024
- Rank Songs by PopularityOA · Seen Oct 2024
- Calculate the SumOA · Seen Oct 2024
- Get Maximum EfficiencyOA · Seen Oct 2024
Similar questions at other companies
- Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
- Largest Microorganism After ConsumptionOpenAI · OAOpenAI interview questions
- Buffet Day GainsUpstart · OAUpstart interview questions
- Remove All Repeated Values from a Linked ListArista Networks · PHONE SCREENArista Networks interview questions
- Deep Copy a Random-Pointer ListAmazon · ONSITE INTERVIEW
- Greedy Person-Cake Matching DistanceSnowflake · PHONE SCREENSnowflake interview questions
- Merge One List Between Two PositionsOracle · ONSITE INTERVIEWOracle interview questions
- Insert into an Unrolled Linked ListIndeed · PHONE SCREEN · ONSITE INTERVIEWIndeed interview questions
- Insert into a Sorted Circular ListMeta · ONSITE INTERVIEWMeta interview questions
- Deep Copy a Random-Pointer ListBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
Interview reports that mention this question
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)