Amazon Interview Question

Remove duplicates from array in place, return new array length

Interview Answer

Anonymous

Feb 29, 2016

Construct a heap = O(n) get the Min, put it back in the Array[N - l] where N is the size of the array, and l is unique element found so far let say curMin = Min coninue removing element from the stack until the Min != curMin