public void sortColors(int[] A) {
        int i = 0;
        int mm = -1;
        int nn = A.length;
        while(i < nn){
            if(A[i] == 0){
                // do need ++i actually because in the next iteration the 3rd condition would work
                // A[i++] = A[++mm];
                A[i] = A[++mm];
                A[mm] = 0;
            }else if(A[i] == 2){
                A[i] = A[--nn];
                A[nn] = 2;
            }else ++i;
        }
        return ;
    }