69. Longest Consecutive Sequence
MediumHashing
Return the length of the longest run of consecutive integers that can be formed from the values in nums (order in the array does not matter). Aim for O(n).
Example 1
Input: nums = [100, 4, 200, 1, 3, 2] Output: 4 Explanation: 1, 2, 3, 4
Constraints
0 ≤ nums.length ≤ 10⁵