115. Longest Consecutive Sequence

MediumArray

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time.

Examples

Input: [100,4,200,1,3,2]

Output: 4

Explanation: Public test case for Longest Consecutive Sequence

Constraints

  • 0 <= nums.length <= 10^5
Loading...

Run checks all cases above. Submit evaluates all test cases.