https://leetcode.com/problems/sort-colors/#/description Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white
遍历一遍的方法:https://leetcode.com/discuss/17000/share-my-one-pass-constant-space-10-line-solution the idea is to sweep all 0s to the left and all 2s to the right, then all 1s are left in the middle. classSolution {public:voidsortColors(intA[],intn) {intsecond=n-1, zero=0;f...