Goldman Sachs Interview Question

Implement a circular array, find whether a number is power of 2 in constant time.

Interview Answer

Anonymous

Sep 9, 2017

I did the circular array by using three variables read, write and circulated. The power of two can be checked by n&(n-1)==0.