Avatar ·

Removing duplicate elements in a sorted list

📁 example

For example, I have a list x = [a, a, a, f, h, k, k] . I need to make it so that there is only one a in this list and one k , i.e. delete extra duplicate elements, do not touch the rest. Duplicate elements are always adjacent because the list is sorted. How to implement the removal of these extra elements?