[Leetcode] Power of Three
来源:互联网 发布:淘宝卖家能给差评吗 编辑:程序博客网 时间:2024/05/22 07:03
Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?
public class Solution { public boolean isPowerOfThree(int n) { if(n<1) return false; while(n>2) { if((n%3)==1||(n%3)==2) return false; else n=n/3; } if(n==1) return true; else return false; }}
0 0
- leetcode Power of Three
- Leetcode: Power of Three
- LeetCode Power of Three
- [leetcode]Power of Three
- LeetCode-Power of Three
- leetcode power of three
- LeetCode----Power of Three
- LEETCODE--Power of Three
- 【leetcode】Power of Three
- leetcode---Power of Three
- 《leetCode》:Power of Three
- leetcode: Power of Three
- [LeetCode]Power of Three
- leetcode Power of Three
- LeetCode|Power of three
- LeetCode - Power of Three
- Leetcode - Power of Three
- LeetCode:Power of Three
- nowcoder--取近似值
- POJ 1149 PIGS 最大流
- Java内存管理原理及内存区域详解
- 数据结构-树相关算法
- 第2周项目3-(2)体验复杂度
- [Leetcode] Power of Three
- Linux字符界面下ls分屏显示
- 忘记Win10电脑密码,修改密码的方法
- C语言取得int的位数
- 博客足迹
- [Leetcode] Power of Two
- 【light-oj】-1109 - False Ordering(数学)
- 工具类:Collections集合工具集
- 《Thinking in java》基础篇之位运算