leetcode 每日一题 1470. 重新排列数组
作者:互联网
leetcode 每日一题 1470. 重新排列数组
class Solution { public int[] shuffle(int[] nums, int n) { int[] arr = new int[nums.length]; for (int i = 0; i < nums.length; i++) { if(i < n){ arr[i*2] = nums[i]; }else{ arr[(i-n)*2 +1] = nums[i]; } } return arr; } }
标签:arr,nums,int,length,1470,重新排列,leetcode 来源: https://www.cnblogs.com/yexuba/p/16636515.html