MCPcopy Index your code
hub / github.com/qiyuangong/leetcode / plusOne

Method plusOne

python/066_Plus_One.py:22–33  ·  view source on GitHub ↗
(self, digits)

Source from the content-addressed store, hash-verified

20 # return digits
21
22 def plusOne(self, digits):
23 ls = len(digits)
24 for index in reversed(range(ls)):
25 if digits[index] < 9:
26 digits[index] += 1
27 # do not need to continue
28 return digits
29 else:
30 # 10
31 digits[index] = 0
32 digits.insert(0, 1)
33 return digits
34
35

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected