1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| class Solution: """ @param digits: a number represented as an array of digits @return: the result """ def plusOne(self, digits): num = 0 power = 1 for i in range(len(digits)-1, -1, -1): num += digits[i] * power power *= 10 num += 1 num = str(num) return list(map(int, list(num)))
|