Skip to content

Commit 0277a02

Browse files
authored
Create: 1470-shuffle-the-array.c
1 parent 198f27b commit 0277a02

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

c/1470-shuffle-the-array.c

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
int* shuffle(int* nums, int numsSize, int n, int* returnSize) {
2+
*returnSize = numsSize;
3+
int* result = (int*)malloc(numsSize * sizeof(int));
4+
5+
int i, j, k;
6+
i = j = k = 0;
7+
8+
while (i < n) {
9+
result[k++] = nums[i];
10+
result[k++] = nums[i + n];
11+
i++;
12+
}
13+
14+
return result;
15+
}

0 commit comments

Comments
 (0)