Intel Corporation Interview Question

Explain what the following code does: ( ( n & ( n-1)) == 0). From cracking the coding interview

Interview Answer

Anonymous

Sep 16, 2019

Checks if n is a power of 2 (or if n is 0)

1