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?
Credits:
Special thanks to @yukuairoy for adding this problem and creating all test cases.
Java Math的floor,round,ceil函数小结
跟上面的题一样,只不过换成了四。
public class Solution {
private static

这是一个关于LeetCode中342题的解决方案,目标是判断一个32位整数是否为4的幂。给定示例中,函数对于num=16返回true,对于num=5返回false。挑战在于如何解决此问题而不使用循环或递归。
订阅专栏 解锁全文
335

被折叠的 条评论
为什么被折叠?



