Remove All Repeated Values from a Linked List
Problem statement
The values of a singly linked list are provided in traversal order. Remove every node whose value occurs more than once, and return the remaining values in their original order.
This array representation preserves the linked-list filtering contract while keeping the callable interface deterministic.
Function
removeRepeatedValues(values: int[]) → int[]Examples
Example 1
values = [1,1,2,2,2,3,4,4]return = [3]Only 3 occurs exactly once.
Example 2
values = [1,2,3]return = [1,2,3]Every node is unique.
Constraints
0 <= values.length <= 100000.-10^9 <= values[i] <= 10^9.
Source note: Author-written prompt excerpt retained for source fidelity.