LeetCode p342 Power of Four 题解
1.题目:
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it without loops/recursion?
题意:
判断一个数是否为4的n次方
2.解题思路:
见代码,枚举。
3.代码
1 |
|