Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Longest Consecutive Sequence #212

Open
pratikj697 opened this issue Oct 2, 2024 · 0 comments
Open

Longest Consecutive Sequence #212

pratikj697 opened this issue Oct 2, 2024 · 0 comments

Comments

@pratikj697
Copy link

In this problem 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.
For example:
Input: nums = [100, 4, 200, 1, 3, 2]
Output: 4
The longest consecutive sequence is [1, 2, 3, 4]. Therefore, its length is 4.

Input: nums = [0,3,7,2,5,8,4,6,0,1]
Output: 9

Constraints are:
0 <= nums.length <= 10^5
-10^9 <= nums[i] <= 10^9
Can yo please assign this problem to me @DevAffan

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants