Tag: longestconsecutivesequence
-
Data Structures & Algorithms in Java – Longest Consecutive Sequence
Problem Given an array of numbers, find the length of the longest consecutive sequence For example , Given the input [100,4,200,1,3,2] The longest consecutive sequence is [1,2,3,4] So the length is 4. Notice that the sequence need not be in order and can be scattered across the array. Try out the solution here: Leetcode Solution…