You are given an unsorted integer array nums.
Your task is to find the length of the longest sequence of consecutive numbers that appear in the array.
The algorithm must run in O(n) time.
A consecutive sequence is a series of numbers that appear in increasing order without gaps (e.g., [4,5,6,7]).
Input: nums = [10, 5, 12, 3, 55, 4, 11, 6]
Output: 4
Input: nums = [15, 16, 18, 14, 19, 13, 12, 17]
Output: 8
Input: nums = [4, 10, 5, 6, 4, 7]
Output: 4
Accepted:
Submission: