Skip to main content
Longest Consecutive Sequence | AlgoCracked
AlgoCracked
ProblemsLongest Consecutive Sequence
Medium47.0% acceptance
Blind75ArrayHash TableUnion Find

Longest Consecutive Sequence

Given an unsorted integer array nums , return the length of the longest run of consecutive integers (values that differ by 1). The elements do not need to be adjacent in the array. Aim for O(n) time. Input format Input is a single array, e.g. [[100,4,200,1,3,2]] .

Loading workspace…