首页 > 编程语言 > 详细

【leetcode】重新排列数组

时间:2020-09-05 23:23:26      阅读:53      评论:0      收藏:0      [点我收藏+]

 

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;
}

 

【leetcode】重新排列数组

原文:https://www.cnblogs.com/ganxiang/p/13619419.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!