see wikipedia for algorithm explaination

https://en.wikipedia.org/wiki/Dutch_national_flag_problem

```
class Solution {
public:
void sortColors(vector<int>& nums)
{
int left = 0, right = nums.size()-1, pos = 0;
for(int pos = 0; pos <= right; pos++)
{
if(nums[pos]==0 && left<pos) swap(nums[left++], nums[pos--]);
if(nums[pos]==2 && pos<right) swap(nums[right--], nums[pos--]);
}
}
};
```