Leetcode in Java && Oracle
422 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-10-23_16-35-57.png
24.1 KB
#N1470. Shuffle the Array
problem link=>https://leetcode.com/problems/shuffle-the-array/

#solution
class Solution {
public int[] shuffle(int[] nums, int n) {
int[] ans=new int[n*2];
for(int i=0; i<n; i++){
ans[i*2]=nums[i];
ans[i*2+1]=nums[i+n];
}
return ans;
}
}