Javascript code to find longest subarray with difference between max and min as at - most 1.
function longestSubarray ( input ) { let prev = - 1 ; let current , next ; let prevCount = 0 , currentCount = 1 ;