Let's do it: [1, 0, 1, 0, 1, 1] (-010) Now: [1, 1, 1, 1] 010 phase done: [1, 1, 1, 1] tmpstr 111 i 0 i 1 tmpstr2 111 5 2 1 1 1 1