[leetcode] - 326. Power of Three

来源:互联网 发布:photoshop mac版破解 编辑:程序博客网 时间:2024/05/17 08:28

判断n是否为3的幂

  public boolean isPowerOfThree(int n) {        return n >= 1 && (1162261467 % n == 0);    }

其中,1162261467为int型中最大的3的幂

0 0
原创粉丝点击