Skip to content

Commit 8e7d7c3

Browse files
authored
Create 1470-shuffle-the-array.js
1 parent 9d26c50 commit 8e7d7c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

1470-shuffle-the-array.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @param {number[]} nums
3+
* @param {number} n
4+
* @return {number[]}
5+
*/
6+
const shuffle = function(nums, n) {
7+
const res = []
8+
for(let i = 0; i < n; i++) {
9+
res.push(nums[i], nums[i + n])
10+
}
11+
return res
12+
};

0 commit comments

Comments
 (0)