class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param cows int整型vector * @return int整型vector */ vector<int> sortCows(vector<int>& cows) { // write code here // 冒泡排序 或用哈希表+重建数组; for(int i=cows.size()-1; i>0; --i) { for(int j=1; j<cows.size(); ++j) { if(cows[j]<cows[j-1]) { int temp = cows[j]; cows[j] = cows[j-1]; cows[j-1] = temp; } } } return cows; } };