Find the length of the longest subsequence where the max and min differ by exactly 1.
Constraints
Example
>>> find_lhs([1,3,2,2,5,2,3,7]) 5 >>> find_lhs([1,2,3,4]) 2 >>> find_lhs([1,1,1,1]) 0
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints