Leetcode 1470. Shuffle the Array
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * @param {number[]} nums * @param {number} n * @return {number[]} */ var shuffle = function(nums, n) { const result = [] for (i = 0; i < n; i++) { result.push(nums[i]) result.push(nums[i + n]) } return result; }; | cs |