Back to Questions

Longest Consecutive Sequence (Set)

92.5K viewsAsked at Uber
Medium

Question Explain

Given an unsorted array, find the length of the longest consecutive elements sequence. The algorithm should run in $O(n)$ time. Use a Hash Set to store elements and optimize lookups.

Start Trying This Question Simulation

Practice answering orally or with text to get instant AI feedback.

Practice with This Question
Longest Consecutive Sequence (Set) - Interview Question