LintCode Python 丑数II
来源:互联网 发布:鞑靼牛肉 知乎 编辑:程序博客网 时间:2024/06/05 08:23
class Solution: """ @param {int} n an integer. @return {int} the nth prime number as description. """ def nthUglyNumber(self, n): # write your code here L = [0, 1] while len(L)-1 < n: for i in L: if i*2 > L[-1]: a = i*2 break for i in L: if i*3 > L[-1]: b = i*3 break for i in L: if i*5 > L[-1]: c = i*5 break L.append(min(a, b, c)) return L[n]
阅读全文
0 0
- LintCode Python 丑数II
- lintcode-丑数 II
- LintCode 4 丑数II
- [LintCode]4.丑数 II
- LintCode----4.丑数II
- LintCode 4.丑数 II
- LintCode python 小白6-丑数 II
- **[Lintcode]Ugly Number II 丑数 II
- (lintcode)第4题 丑数II
- lintcode python代码 517丑数
- LintCode python 小白5-丑数
- LintCode笔记(8)——丑数II
- lintcode 4.丑数 II(优先队列)
- 丑数、丑数 II
- LintCode 丑数
- LintCode-丑数
- LintCode:超级丑数
- LintCode 517 丑数
- 【整理收集】下载电影影视就找这些网站了!影视资源网站收集
- MySQL触发器
- 百度之星 今夕何夕
- 小C的倍数问题
- day11 sql
- LintCode Python 丑数II
- CSU1979: 古怪的行列式
- UVA10491CowsAndCars
- day12 sql
- auto_ptr、shared_ptr、weak_ptr、scoped_ptr用法小结
- 程序员读书啦!!!
- 欢迎使用CSDN-markdown编辑器
- java 将源目录的所有文件(含子目录)拷贝到 目标目录中(运用File类实现)
- HDU 畅通工程&&还是畅通工程(查表法)