Remove Duplicates from sorted list same as remove duplicates from array