bool power2(int n){ if(n == 0 || n == 1 ) return true; else{ if(n % 2 != 0) return false; else return power2(n/2); } } bool fastPower2(int n){ return (n & (n-1)) == 0; }