342. Power of Four

来源:互联网 发布:java shiro控制到按钮 编辑:程序博客网 时间:2024/05/04 10:06

题目:https://leetcode.com/problems/power-of-four/

代码:

public class Solution {    public boolean isPowerOfFour(int num) {        if(num==1)            return true;        if(num<4)            return false;        int i=0;        while(Math.pow(4,i)<num)        {            i++;        }        if(Math.pow(4,i)==num)            return true;        else            return false;    }}2ms
0 0
原创粉丝点击