This question is from job interview...
Use this template to write a C++ function that checks if a positive integer is a power of two.
bool p(int n) { return ********; } You have to replace the 8 '*' symbols with other symbols in order to make the function work correctly.
My best approach was this:
bool p(int n) { return !(n&=n-1); } Unfortunately it was wrong, because there are 9 symbols here...
Any ideas?