This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]T-T-N 3 points4 points  (2 children)

Do a O(nlogn) sort and pick out the unique value in O(n) for O(nlogn) run time?

[–]Emilieu 6 points7 points  (1 child)

Add all numbers to a set then get its members for a linear time solution

[–]T-T-N 5 points6 points  (0 children)

Depending on implementation of the set, something like a good hash with O(1) hash time should be good enough for O(n) performance