[Hackerrank] Picking Numbers
Given an array of integers, find the longest subarray where the absolute difference between any two elements is less than or equal to 1. Example a = [1,1,2,2,4,4,5,5,5] There are two subarrays meeting the criterion: [1,1,2,2] and [4,4,5,5,5]. The maximum length subarray has 5 elements. Function Description Complete the pickingNumbers function in the editor below. pickingNumbers has the following..
더보기