231. Power of Two

as same as power of Three

public class Solution {
    public boolean isPowerOfTwo(int n) {
        if(n < 1) return false;
        
        return (Math.log10(n)/Math.log10(2))%1 == 0;
    }
}
posted @ 2016-10-21 06:58  哇呀呀..生气啦~  阅读(63)  评论(0)    收藏  举报