Implement `longestConsecutive(nums)` returning the length of the longest run of consecutive integers present in the array (order in the array does not matter). Aim for O(n) time.
+ 2 hidden tests run on Submit.
A set gives constant-time lookups. Each run is counted exactly once because counting only begins at a value with no predecessor in the set, so the inner while loop visits every element at most once overall. O(n) time.
Run your code to see results.