Leetcode学习(31)—— Add Digits
2017-05-08 23:58
232 查看
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
Follow up:
Could you do it without any loop/recursion in O(1) runtime?
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
Follow up:
Could you do it without any loop/recursion in O(1) runtime?
相关文章推荐
- leetcode学习篇五——Add Digits
- LeetCode编程练习 - Add Digits学习心得
- 包含多个段的程序03 - 零基础入门学习汇编语言31
- more effective c++学习笔记 ---- 条款31
- 31 天重构学习笔记31. 使用多态代替条件判断
- 每天学习一算法系列(31)(实现一个队列,队列的应用场景为:一个生产者线程将int 类型的数入列,一个消费者线程将int 类型的数出列)
- 2112-03-31 C#基础学习笔记(1)
- 2011_08_31_看雪重要学习网址保存
- EF学习杂记31:如何在EF查询中引入外部函数
- 31、深入浅出MFC学习笔记,定制AppWizard
- [转]Ultra Fractal教程系列31——关于变换的学习06——添加框架
- 新概念第二册学习笔记六(31--36)
- Silverlight入门学习(31)
- 31 天重构学习笔记9. 提取接口
- 31天重构学习笔记31. 使用多态代替条件判断
- GCC-3.4.6源代码学习笔记(31)
- AJAX ControlToolkit学习日志-ValidatorCalloutExtender(31)
- 有关Theme(主题)的研究——Silverlight学习笔记[31]
- GDI+ 学习记录(31) 图像颜色变换(TGPImageAttributes)
- 巴巴运动网学习笔记(31-35)