As reported: Arista Networks round 1 (C++, May 2026): complete the function in VS Code and make it runnable. Example from the round:
1→1→2→2→2→3→4→4gives3.
This is LeetCode 82 — Remove Duplicates from Sorted List II.
Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only the numbers that appear exactly once. Return the list, still sorted.
Example 1
head = [1,1,2,2,2,3,4,4] -> [3]
Example 2
head = [1,2,3,3,4,4,5] -> [1,2,5]
Example 3
head = [1,1,1,2,3] -> [2,3]
Constraints: the list has 0 to 300 nodes; −100 ≤ Node.val ≤ 100; the list is sorted in ascending order.
Code runner format: one line holding the list as a JSON array (LeetCode's test-case format). Implement deleteDuplicates(head); the harness prints the resulting list.