Code
class Solution {
public int[] shuffle(int[] nums, int n) {
int[] newNums = new int[nums.length];
for (int i = 0; i < n; i++) {
newNums[i * 2] = nums[i];
}
for (int j = 1; j < nums.length; j += 2) {
newNums[j] = nums[n + (j / 2)];
}
return newNums;
}
}
Top comments (0)