LeetCode刷题(13)
来源:互联网 发布:英国的域名 编辑:程序博客网 时间:2024/06/16 08:51
Plus One
在一个有数列表示的数的基础上加一
class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ n = len(digits) i = n - 1 while i >= 0: if digits[i] == 9 : digits[i] = 0 i -= 1 else : digits[i] += 1 return digits return [1] + digits
阅读全文
0 0
- Leetcode刷题(13)
- LeetCode刷题(13)
- 【leetcode】leetcode 刷题 笔记 (不定期更新)
- leetcode刷题(Python)
- LeetCode刷题(1)
- LeetCode刷题(2)
- LeetCode刷题(3)
- LeetCode刷题(废弃)
- LeetCode刷题(FizzBuzz)
- Leetcode刷题(1)
- Leetcode刷题(2)
- Leetcode刷题(3)
- Leetcode刷题(4)
- Leetcode刷题(5)
- Leetcode刷题(6)
- Leetcode刷题(7)
- Leetcode刷题(17)
- LeetCode刷题(18)
- BeanFactory not initialized or already closed
- Spring 框架及相关问题记录
- 《Spring实战》学习笔记之一:Spring之旅
- 问题BeanFactory not initialized or already closed
- * 继承与派生 编程题#1(Coursera 程序设计与算法 专项课程3 C++程序设计 郭炜、刘家瑛;OpenJudge)
- LeetCode刷题(13)
- 关于javaweb中sql语句中使用变量的情况
- 10个不得不买的高科技智能机器人
- 设计模式-动态代理
- 后缀表达式、前缀表达式
- 单节点安装openstack 之 计算节点nova 安装
- IRC---极客范儿
- BeanFactory not initialized or already closed
- 排序算法之快速排序