public class Solution {
    public bool IsPowerOfFour(int num) {
        return (num > 0) && ((num & (num - 1)) == 0) && ((num & 0x55555555) == num);
    }
}

https://leetcode.com/problems/power-of-four/#/description

posted on 2017-04-21 09:01  Sempron2800+  阅读(98)  评论(0编辑  收藏  举报