Python 98.30 % beats || 2 Approachs || Simple Code
Your upvote is my motivation!\n\n# Code\n# Approach 1 (Array) -> 98.30 % beats\n\nclass Solution:\n    def plusOne(self, digits: List[int]) -> List[int]:\n\n   
# Your upvote is my motivation!\n\n# Code\n# Approach 1 (Array) -> 98.30 % beats\n```\nclass Solution:\n    def plusOne(self, digits: List[int]) -> List[int]:\n\n        for i in range(len(digits)-1, -1, -1):\n            if digits[i] == 9:\n                digits[i] = 0\n            else:\n                digits[i] = digits[i] + 1\n                return digits\n        return [1] + digits \n\n        \n```\n\n# Approach 2 (Convert list -> Number :: -> Addition +1 :: -> Number  -> List\n```\nclass Solution:\n    def plusOne(self, digits: List[int]) -> List[int]:\n        # List -> Number\n        n = 0\n        for ele in digits:\n            n = (n*10) + ele\n        \n        n = n+1\n        \n        # Number -> List\n        digits = []\n        while n > 0:\n            digits.insert(0, n % 10)  \n            n //= 10 \n        return digits\n```
['Array', 'Math', 'Python', 'Python3']