博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2020-11-04L 922. 按奇偶排序数组 II
阅读量:3959 次
发布时间:2019-05-24

本文共 376 字,大约阅读时间需要 1 分钟。

var sortArrayByParityII = function(A) {    let len = A.length;    let arr0 = [];    let arr1 = [];    for(let i = 0; i < len; i++){        if(A[i]%2 == 0){            arr0.push(A[i]);        }else{            arr1.push(A[i]);        }    }    var i = 0;    for(let j = 0; j < len; j++){        A[j] = arr0[i];        ++j;        A[j] = arr1[i];        i++;    }    return A;};

 

转载地址:http://khtzi.baihongyu.com/

你可能感兴趣的文章
hdu——2087剪花布条 ( kmp 和 find用法 )
查看>>
strstr函数和find函数的异同
查看>>
hdu——3746Cyclic Nacklace(kmp专练)
查看>>
hdu——1358Period(kmp专练)
查看>>
hust——1010F - The Minimum Length(kmp专练)
查看>>
poj——2406Power Strings(kmp专练)
查看>>
poj——2752Seek the Name, Seek the Fame(kmp专练 找出前后相同的字串)
查看>>
校赛 选修课网址 1096: Is The Same?(kmp或者find)
查看>>
选修课网址 1088: The Owl and the Fox
查看>>
校赛 选修课网址 1097: Meeting
查看>>
hdu——2084数塔
查看>>
hdu——1010Tempter of the Bone
查看>>
hdu——1062Text Reverse(反转函数reverse)
查看>>
hdu——1061Rightmost Digit(快速幂)
查看>>
无向图最短路径dijkstra算法
查看>>
hdu 1284钱币兑换问题(dp)
查看>>
hdu 1028Ignatius and the Princess III(dp)
查看>>
hdu 1398Square Coins(dp或者母函数)
查看>>
hdu 2069Coin Change(dp)
查看>>
hdu 1159Common Subsequence(dp 最大不连续的子序列)
查看>>