Given an unsorted array of integers, find the length of the longest consecutive elements sequence in O(n) time.
Input: nums = [100,4,200,1,3,2] Output: 4 ([1,2,3,4]) Input: nums = [0,3,7,2,5,8,4,6,0,1] Output: 9
Unlock hints progressively β start gentle, go deeper only if needed.
Level 1: Gentle Nudge
A subtle direction
Level 2: Approach
The algorithm to use
Level 3: Detailed
Step-by-step guidance
to save progress and use AI features