Skip to content

Commit 6adb0c7

Browse files
plus one string (easy) added
1 parent 4882a16 commit 6adb0c7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's.
3+
4+
Increment the large integer by one and return the resulting array of digits.
5+
6+
Question: https://leetcode.com/problems/plus-one/
7+
8+
"""
9+
10+
class Solution:
11+
def plusOne(self, digits: List[int]) -> List[int]:
12+
n = 0
13+
for i in range(len(digits)):
14+
n = (n*10)+digits[i]
15+
n = n+1
16+
m = map(int, str(n))
17+
return(m)
18+

0 commit comments

Comments
 (0)