class Solution:
# @param digits, a list of integer digits
# @return a list of integer digits
def plusOne(self, digits):
carry=1
for i in range(len(digits)-1,-1,-1):
digits[i]+=carry
if digits[i]>=10:
digits[i]-=10
carry=1
else:
carry=0
break
if i==0 and carry==1:
digits.insert(0,1)
return digits
sol=Solution()
print sol.plusOne(digits=[10,10])
相关文章
- 02-11LeetCode - 解题笔记 - 66 -Plus One
- 02-11【leetcode❤python】66. Plus One
- 02-11LeetCode OJ 66. Plus One
- 02-11【LeetCode】66. Plus One
- 02-1166. Plus One【leetcode】
- 02-11【LeetCode】623. Add One Row to Tree 解题报告(Python)
- 02-11【LeetCode每天一题】Plus One(加一)
- 02-11Leetcode66_Plus One_Eassy
- 02-11(数组) leetcode 66. Plus One
- 02-11[Leetcode]--Plus One