lintcode python代码 517丑数
来源:互联网 发布:linux重启 编辑:程序博客网 时间:2024/06/03 20:18
只包含2 3 5质数的数是丑数
思路:丑数的质数因子只有2,3,5 被这些质因子整除后一定为1。
class Solution: # @param {int} num an integer # @return {boolean} true if num is an ugly number or false def isUgly(self, num): # Write your code her if num <= 0: return False while num % 2 == 0: num = num / 2 while num % 3 == 0: num = num / 3 while num % 5 == 0: num = num / 5 if num == 1: return True else: return False
阅读全文
0 0
- lintcode python代码 517丑数
- LintCode 517 丑数
- LintCode Python 丑数II
- LintCode python 小白5-丑数
- LintCode 丑数
- LintCode-丑数
- lintcode-丑数 II
- LintCode:超级丑数
- LintCode.517.丑数
- 丑数-LintCode
- 超级丑数-LintCode
- LintCode python 小白6-丑数 II
- LintCode python 小白7-超级丑数
- LintCode 4 丑数II
- [LintCode]4.丑数 II
- LintCode----4.丑数II
- LintCode 4.丑数 II
- Python:丑数
- 链接资源
- Android编程实现WebView自适应全屏方法小结
- Unity命令的命令行参数
- Boost库——auto_ptr、scoped_ptr、share_ptr、weak_ptr小结
- matlab std函数 用法及实例
- lintcode python代码 517丑数
- SOA服务治理整体框架图
- 大神Yann LeCun亲授:如何自学深度学习技术并少走弯路本
- ECMAScript6(13):Generator 函数
- UE4网络的简单原理
- nginx安装
- linux 内核定时器打印进程信息
- Android 开机动画
- 图像处理之应用卷积– 轧花与边缘检测