You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split. Example…
You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split. Example…
方法一: function group(array, subGroupLength) { let index = 0; let newArray = []; while(index < array.length) { newArray.push(array.slice(index, index += subGroupLength)); } return newArray; } 2,例如: var Array = [1,2,3,4,5,6,7,8,9,10,11,12];; var grouped…
reSetData(dataList,num) { let arr = []; let len = dataList.length; for (let i = 0; i < len; i += num) { arr.push(dataList.slice(i, i + num)); } return arr;}…