Remove Duplicates from Sorted List

Easy · Linked Lists · about 10 minutes

Asked at Bloomberg, Google, Amazon, Microsoft, Meta.

The list is sorted. Keep only the first node of each run of equal values so every value appears once, and return the head of the (still sorted) list.