```
class Solution {
public:
bool isPowerOfFour(int num) {
if (num <= 0) return false;
int root = round(sqrt(num));
// check if num was a perfect square.
if (num != root * root){
return false;
}
// check if root is a power of 2.
return (root & (root - 1)) == 0;
}
};
```