Simple Swift solution
\nfunc plusOne(_ digits: [Int]) -> [Int] {\n        var result = digits\n        for i in (0..<result.count).reversed() {\n            if result[i] != 9 {\n    
```\nfunc plusOne(_ digits: [Int]) -> [Int] {\n        var result = digits\n        for i in (0..<result.count).reversed() {\n            if result[i] != 9 {\n                result[i] = result[i]+1\n                return result\n            } else {\n                result[i] = 0\n            }\n        }\n        if result.first == 0 {\n            result.insert(1, at: 0)\n        }\n        return result\n    }\n```\nExplanation: Loop from the end of the array to start. Just add 1 if the digit is not a 9, and return. If digit is a 9, replace it with a 0 and go to the previous digit - rinse an repeat. In the end, check if the first digit of the resulting array is a 0. If it is, that means that the number was of the form 9999... In this case, insert a 1 in the start.
[]