Implement a circular array, find whether a number is power of 2 in constant time.
Anonymous
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.
Check out your Company Bowl for anonymous work chats.