Question:
Given an integer, write a function to determine if it is a power of two.
Solution: 12msĀ
class Solution { public: bool isPowerOfTwo(int n) { long testNum = 1; while(n >= testNum){ if (n == testNum) return true; testNum <<= 1; } return false; } };