【leetcode】重新排列数组

 

int* shuffle(int* nums, int numsSize, int n, int* returnSize){
    int* arr = (int*)calloc(numsSize, sizeof(int));
    int pst = 0;
    for (int i = 0; i < numsSize/2; i++)
    {
        arr[pst++] = nums[i];
        arr[pst++] = nums[i+n];
    }
    *returnSize = numsSize;
    return arr;
}

 

posted @ 2020-09-05 19:42  温暖了寂寞  阅读(164)  评论(0编辑  收藏  举报