标签:abi 顺序 solution cto size -- blog 调整数组顺序 ==
class Solution { public: void reOrderArray(vector<int> &array) //加个&表示引用 { int array_size = array.size(); //int xiabiao = (array_size - 1); vector<int> brray; for (int i = 0; i < array_size; ++i) { brray.push_back(array[i]); } int i = 0; int k = 0; int j = 0; while (i < array_size) { if ((brray[i]) % 2 != 0) { array[k] = brray[i]; ++k; } ++i; } while (j < array_size) { if ((brray[j]) % 2 == 0) { array[k] = brray[j]; ++k; } ++j; } } };
标签:abi 顺序 solution cto size -- blog 调整数组顺序 ==
原文地址:http://www.cnblogs.com/159269lzm/p/7295279.html