Longest Consecutive Subsequence

00:00
MediumArrayHashSet
AmazonGoogle

Using a HashSet, find the longest sequence of consecutive integers in O(n).

Examples

Input → [100,4,200,1,3,2]
Output → 4
Note: 1,2,3,4
Input → [0,3,7,2,5,8,4,6,0,1]
Output → 9
Note: 0-8
Input → [1]
Output → 1