542. Longest Consecutive Sequence
0
Medium
Rohit requires assistance in finding the length of the longest consecutive sequence in an unsorted array of integers, nums.
Input Format
The first line of input contains an integer N, representing the size of the array. The second line contains N space-separated integers, forming the array.
Output Format
Print the length of the longest consecutive elements sequence.
Example
Input
6
200 100 4 1 2 3
Output
4
Constraints
1 <= N <= 10^5
-10^4 <= nums[i] <= 10^4
Loading...
View Submissions
Console