Given an array like the one below, I was wondering if there is an easy way to turn this array into an array with unique values only?
This is given:
Two options
Keep a map of count and element and finally only use those elements with count 1. (Need extra storage but is faster)
Sort the array and as you move through the array only use non-repeated ones.
Doesn't need extra space but will be O(n lg(n))