I have a list
A= [1,2,3,3,4,4,5,6,4,7]
I want to only keep one 3
and 4
if they are next to another identical one.
Thus A should become
A= [1,2,3,4,5,6,4,7]
I tried to use set
set[A]
{1, 2, 3, 4, 5, 6, 7}
But it removed the last 4
that I want to keep. It seems I should loop through the list and compare i and i+1. Wondering any faster and smarter way exists?