Category Archives: Stack

Longest Consecutive Sequence In Array

Longest Consecutive Sequence In Array

Given an unsorted array of integers, find the length of the longest consecutive elements sequence in O(n), but the consecutive numbers can be in any order.

Latest Source Code:
Github: LongestConsecutiveSequenceInArray.java


Output:

Array: [36, 41, 56, 35, 44, 33, 34, 92, 43, 32, 42]
Max length: 5