Remove All Duplicates from Sorted List
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given the head of a linked list whose values are sorted in **non-decreasing** order. Delete every node whose value occurs **more than once** in the list, so only values that appeared exactly one time survive.
This is stricter than ordinary de-duplication: if a value appears three times, all three nodes are removed, not two of them.
Return the head of the resulting list, which remains sorted. If nothing survives, return an empty list.
Examples
Constraints
- 0 <= number of nodes <= 300
- -100 <= Node.val <= 100
- The list is sorted in non-decreasing order
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.