###### Plus One【leetcode】【89】【E】

Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit is at the head of the list.

class Solution(object):
def plusOne(self, digits):
l = len(digits)
d = digits
p = 1 #表示进位

for i in range(l-1,-1,-1):
res = d[i] + p
if  res > 9:
d[i] = (res-10)
p = 1
else:
d[i] = res
p = 0
if p == 1:
d = [1]+d
return d
"""
:type digits: List[int]
:rtype: List[int]
"""



#### LeetCode --- 66. Plus One

2015-03-19 21:53:21

#### LeetCode Plus One Java版解题报告

2015-01-10 23:03:51

#### 【LeetCode with Python】 Plus One

2014-07-06 15:21:09

#### LeetCode 66 — Plus One（C++ Java Python）

2014-04-02 08:53:48

#### Plus One -- LeetCode

2014-03-28 07:04:57

#### [leetcode]Plus One C语言

2015-08-27 15:23:14

#### LeetCode（66）Plus One

2015-08-18 15:38:10

#### 【leetcode】66. Plus One【java】

2016-12-17 15:43:36

#### leetcode：Plus One （加一）【面试算法题】

2013-10-17 17:17:53

#### [leetcode] 369. Plus One Linked List 解题报告

2016-06-28 23:52:19

## 不良信息举报

Plus One【leetcode】【89】【E】