Skip to main content
mediumBlind 75

Longest Consecutive Sequence

Given an unsorted array of integers Find the length of the longest consecutive elements sequence Must run in O(n) time Example: [100,4,200,1,3,2] => 4 (sequence is [1,2,3,4])

Under the hood, Longest Consecutive Sequence is about traversing relationships without getting trapped in cycles. Interviewers love it because it reveals your modeling relationships and your edge-case discipline. Be careful with cycles and disconnected pieces; a missing visited rule can blow up quickly.

Arrays & HashingGraphs

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Longest Consecutive Sequencemedium
2Part 2
3Part 3

Each locked part opens in the editor once the part before it passes.

Based onLeetCode