In [748]: s = Solution(); print s.subsets([1, 2, 3]) i = 0 000 & 001 -> 0 000 & 010 -> 0 000 & 100 -> 0 i = 000 tmp = [] i = 1 001 & 001 -> 1 pick 001 [1, 2, 3] j = 0 target 1 001 & 010 -> 0 001 & 100 -> 0 i = 001 tmp = [1] i = 2 010 & 001 -> 0 010 & 010 -> 2 pick 010 [1, 2, 3] j = 1 target 2 010 & 100 -> 0 i = 010 tmp = [2] i = 3 011 & 001 -> 1 pick 001 [1, 2, 3] j = 0 target 1 011 & 010 -> 2 pick 010 [1, 2, 3] j = 1 target 2 011 & 100 -> 0 i = 011 tmp = [1, 2] i = 4 100 & 001 -> 0 100 & 010 -> 0 100 & 100 -> 4 pick 100 [1, 2, 3] j = 2 target 3 i = 100 tmp = [3] i = 5 101 & 001 -> 1 pick 001 [1, 2, 3] j = 0 target 1 101 & 010 -> 0 101 & 100 -> 4 pick 100 [1, 2, 3] j = 2 target 3 i = 101 tmp = [1, 3] i = 6 110 & 001 -> 0 110 & 010 -> 2 pick 010 [1, 2, 3] j = 1 target 2 110 & 100 -> 4 pick 100 [1, 2, 3] j = 2 target 3 i = 110 tmp = [2, 3] i = 7 111 & 001 -> 1 pick 001 [1, 2, 3] j = 0 target 1 111 & 010 -> 2 pick 010 [1, 2, 3] j = 1 target 2 111 & 100 -> 4 pick 100 [1, 2, 3] j = 2 target 3 i = 111 tmp = [1, 2, 3] [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
|