Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 949 Bytes

326.md

File metadata and controls

39 lines (31 loc) · 949 Bytes

✏️Leetcode之PHP版题目解析(326. Power of Three)

2019-04-20 吴亲库里 库里的深夜食堂


✏️描述

给定一个整数,判断是否是3的幂数


✏️题目实例

****
    /**
        * @param Integer $n
        * @return Boolean
        */
       function isPowerOfThree($n) {
           if($n==0){
               return false;
           }
           $is_power=1;
           while($n%3==0){
               $n =floor($n/3);
           }
           return $is_power==$n;
       }

联系