How to flip a single bit in a num?
num = num^(1<<i)