Longest Consecutive Sequence

Medium
ArrayHash TableUnion FindGoogleMeta
Given an unsorted array, print the length of the longest run of consecutive integer values. Input format: - First line: n - Second line: n integers

Constraints

0 <= n <= 10^5
-10^9 <= nums[i] <= 10^9

Sample tests

Sample 1

Sample 2

Sign in to submit