Longest Consecutive Sequence

Given an integer array nums, return the length of the longest sequence of values that increases by exactly 1 from one element to the next.

The sequence does not need to be contiguous in the original array. You only care that the values exist somewhere in nums.

Examples
Input: [100,4,200,1,3,2]
Output: 4
Hints
Related Problems

Longest Consecutive Sequence

Given an integer array `nums`, return the length of the longest sequence of values that increases by exactly `1` from one element to the next.