一、问题描述
二、解题思路
先把数组提取出来,换成整数,然后通过除法运算将整数转换成数组
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
n = 0
for i in digits:
n = n * 10 + i
n = n + 1
res = []
while n>0:
# insert方法的第一个参数表示位置(下标),第二个参数表示要插入的数据
res.insert(0, n%10) # 涉及数组扩容问题
n = n//10
return res