subject :
The highest digit is placed at the top of the array , Each element in the array stores only a single number .
You can assume that except for integers 0 outside , This integer will not start with zero .
[9,9] ===> [1,0,0]
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
sum = 0
l = len(digits)-1
for s in digits:
sum += s * 10**l
l = l -1
sum += 1
result = list(str(sum)) # If so str(sum) You can get the same result , But the efficiency is relatively low
result = list(map(int,result)) # use Python take list Medium string Convert to int, among result Itself should be list type , Here, you may default to string Type into list type
return result
digits = [9,9]
S = Solution()
result = S.plusOne(digits)
print(result)