Find if the given number is a power of 2
I am sure it has got something to do with bitwise operators, but for some reason, my brain aint working.
take the biggest power of 2 that will fit in an int. Does your number divide it evenly? If so then it's a power of 2.
.... or an alternative:
That's darn clever. Although (unless you consider 1 to be a power of 2) I suggest
Fog Creek Home