Home
Related Problems
Longest Consecutive Sequence
Medium
Arrays & Hashing
•
NeetCode 150
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.
Constraints:
0 <= nums.length <= 105
-109 <= nums[i] <= 109
Show Test Cases
Show Solution