Exercises/#128 Longest Consecutive Sequence
#128

Longest Consecutive Sequence

MediumπŸ“¦ Arrays
90 XP

Problem

Given an unsorted array of integers, find the length of the longest consecutive elements sequence in O(n) time.

Examples

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
arrayhash-set
AI Assistantβ€” powered by AI

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

128 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features