Python | 100% Speed | One Liner + Hardworking Way
Python | 100% Speed | One Liner + Hardworking Way\n\nA) Python One-Liner\n\nShameless Python One-Liner, O(n) solution.\nDe-compressed Steps:\n\n1. The integer-a
**Python | 100% Speed | One Liner + Hardworking Way**\n\n**A) Python One-Liner**\n\nShameless Python One-Liner, O(n) solution.\nDe-compressed Steps:\n\n1. The integer-array "digits" is first converted into a joined string: [1,2,3] -> "123".  ***Code:**   a = \'\'.join(map(str,digits))*\n2. The joined string is then converted into an integer, and we add one.  ***Code:**   b = int(a)+1\n3. Our new integer is re-converted into a string, and then into a list format. Finally, the INT operator is applied to each element of the list to obtain new integer digits ***Code:**   [ int(c) for c in str(b) ]  or  list(map(int,str(b)))\n\n```\n# Version A: Outer Loop\nclass Solution:\n    def plusOne(self, digits: List[int]) -> List[int]:\n        return [int(x) for x in  str(int(\'\'.join(map(str,digits)))+1) ]\n```\n\n```\n# Version B: Pure Functions\nclass Solution:\n    def plusOne(self, digits: List[int]) -> List[int]:\n        return list(map(int,str(int(\'\'.join(map(str,digits)))+1)))\n```\n\n**B) Hardworking Digit Processing - O(1) space**\n```\n# Hard-Working Version: Manual Digit Check\n# O(1) space, and O(1) time for most cases as well (with few chained 9\'s in the lower digits)\nclass Solution:\n    def plusOne(self, digits: List[int]) -> List[int]:\n        if not digits:\n            return digits\n        i = len(digits)-1\n        digits[i] += 1\n        while digits[i]==10:\n            digits[i] = 0\n            if i==0:\n                digits.insert(0,1)\n            else:\n                digits[i-1] += 1\n                i -= 1\n        return digits\n```
['Python', 'Python3']