Hey everyone I came up with another leetcode issue. I am working on Leetcode “66. Plus One“. I wrote the code and ran it. it is passing all the test cases but when I am trying to submit it, showing wrong answer. what is wrong with the code.
class Solution(object): def plusOne(self, digits): new_digit=digits[-1]+1 digit1=[] result=0 remove=digits[-1] digits.remove(remove) for i in digits: digit1.append(i) digit1.append(new_digit) digit2=[] for i in digit1: if i>=10: digit2 = list(map(int, str(i))) return digit2 else: return digit1
submitted by /u/Professional-Egg-788
[link] [comments]
r/learnpython Hey everyone I came up with another leetcode issue. I am working on Leetcode “66. Plus One”. I wrote the code and ran it. it is passing all the test cases but when I am trying to submit it, showing wrong answer. what is wrong with the code. class Solution(object): def plusOne(self, digits): new_digit=digits[-1]+1 digit1=[] result=0 remove=digits[-1] digits.remove(remove) for i in digits: digit1.append(i) digit1.append(new_digit) digit2=[] for i in digit1: if i>=10: digit2 = list(map(int, str(i))) return digit2 else: return digit1 submitted by /u/Professional-Egg-788 [link] [comments]
Hey everyone I came up with another leetcode issue. I am working on Leetcode “66. Plus One“. I wrote the code and ran it. it is passing all the test cases but when I am trying to submit it, showing wrong answer. what is wrong with the code.
class Solution(object): def plusOne(self, digits): new_digit=digits[-1]+1 digit1=[] result=0 remove=digits[-1] digits.remove(remove) for i in digits: digit1.append(i) digit1.append(new_digit) digit2=[] for i in digit1: if i>=10: digit2 = list(map(int, str(i))) return digit2 else: return digit1
submitted by /u/Professional-Egg-788
[link] [comments]