```
class Solution {
public:
bool isPowerOfFour(int num) {
if (num <= 0) return false;
if (num & num - 1) return false;
return num % 3 == 1;
}
};
```

I observed that `2 ** k % 3 = 1`

if and only if `k`

is even, that is, `2 ** k`

is a power of 4.

So we can just check whether these three conditions are all true:

`num`

must be positive`num`

must be power of 2`num`

mod 3 must be 1