标签:span code style alt tco leetcode void dex solution
class Solution { public: void sortColors(vector<int>& nums) { if(nums.size()==0) return; int len=nums.size(); vector<int> arr(3,0); for(int num:nums) arr[num]++; int index=0; for(int i=0;i<arr.size();i++){ int k=arr[i]; while(k--){ nums[index++]=i; } } } };
标签:span code style alt tco leetcode void dex solution
原文地址:https://www.cnblogs.com/joelwang/p/10931303.html