class Solution: # @param digits, a list of integer digits # @return a list of integer digits def plusOne(self, digits): n=len(digits) if n==0: return [1] i=n-1 while i>=0: if digits[i]+1<10: digits[i]+=1 return digits digits[i]=0 i-=1 digits.insert(0,1) return digits
Sunday, September 7, 2014
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment