342. Power of Four

Posted wentiliangkaihua

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了342. Power of Four相关的知识,希望对你有一定的参考价值。

Given an integer (signed 32 bits), write a function to check whether it is a power of 4.

Example 1:

Input: 16
Output: true

Example 2:

Input: 5
Output: false
class Solution {
    public boolean isPowerOfFour(int num) {
         return Math.log10(num) / Math.log10(4) % 1 == 0; 
    }
}

 

以上是关于342. Power of Four的主要内容,如果未能解决你的问题,请参考以下文章

342. Power of Four

342. Power of Four

342 Power of Four 4的幂

[leetcode] 342. Power of Four

342. Power of Four(LeetCode)

LeetCode 342. Power of Four