Given an unsorted array of integers , return the length of the longest consecutive elements sequence. You must write an algorithm that runs in time.
For example, given , the longest consecutive sequence is , so the answer is .
This problem tests your ability to use sets cleverly. Sorting would take , so you need a different approach.