Bit Mask

(num >> i) & 1 => num 二進制右移 i 位後, 跟 1 and, 取最右邊這位是不是1

mask < (1 << n)

1 << n means 2^n
so if n = 4 
-> 2^4 = 32

usually, use in loop all mask posibility
so 

n = 4
int i = 0; i < (1 << n); i++
-> means
int i = 0; i < 32; i++

Last updated