I got this interview question I think is impossible.
If you have an array and you must in place remove all unique elements from it in place while keeping the order and with no extra memory.
E.g.
input = [1,1,2,3,4,3,4]
output = [1,1,3,4,3,4]
I tried, sorting, but you have to keep the items in place.
Two pointers, which are O(n^2) and counters which use extra memory but those weren't efficient enough.
Maybe something with bit flips?