Longest Consecutive Sequence

MEDIUM|

Store all numbers in a HashSet. Only start counting streaks from numbers where (num - 1) is not present, guaranteeing each number is visited at most twice.