mycode

class Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
while n > 2:
if n%3 != 0 :
return False
n = n // 3
print(n)
return n == 1

参考

class Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
if n <= 0:
return False
while n%3 == 0:
n = n/3
return n==1

最新文章

  1. Entity Framework 6 Recipes 2nd Edition(9-3)译-&gt;找出Web API中发生了什么变化
  2. 微软云Azure Website 远程调试
  3. Laravel 5.1 文档攻略 —— Eloquent Collection
  4. 组合数问题hdu5894
  5. 如何把项目托管到GitHub
  6. Redis 3.0 集群搭建
  7. Leetcode 225 Implement Stack using Queues
  8. 1015. Reversible Primes (20)
  9. Mysql 配置主从服务自动同步功能
  10. php之面向对象(2)
  11. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(29)-T4模版
  12. C++ tree(1)
  13. linux常用命令(CentOS)
  14. springaop——AspectJ不可不知的细节
  15. Python异常处理详解
  16. 【Java每日一题】20170216
  17. Android 闪烁动画
  18. Bootstrap知识记录:排版样式
  19. [js]this关键字代表当前执行的主体
  20. 八(第三篇)、主体结构元素——time元素、pubdate属性

热门文章

  1. Zookeeper VS Chubby
  2. int 问号的使用
  3. mongodb的简单操作记录
  4. CISCO运维记录之4507设备升级IOS(Version 03.03.02.SG版本存在bug)
  5. leetcode上题目的分类
  6. leetcode二刷结束
  7. Lambda学习总结(二)--Stream流
  8. 组件(2):使用Prop下发数据
  9. spring cache 几个注解解释
  10. hiho #1144 : 01串(模拟)