Array of 0,1,2 only. One-pass three pointers: lo, mid, hi.
Input
6 2 0 2 1 1 0
Output
0 0 1 1 2 2
3 2 0 1
0 1 2