✔️ 100% Fastest Swift Solution, time: O(n), space: O(n).
\nclass Solution {\n    // - Complexity:\n    //   - time: O(n), where n is the length of the digits.\n    //   - space: O(n), where n is the length of the digi
```\nclass Solution {\n    // - Complexity:\n    //   - time: O(n), where n is the length of the digits.\n    //   - space: O(n), where n is the length of the digits.\n\n    func plusOne(_ digits: [Int]) -> [Int] {\n        var digits = digits\n\n        for i in (0..<digits.count).reversed() {\n            guard digits[i] == 9 else {\n                digits[i] += 1\n                return digits\n            }\n\n            digits[i] = 0\n        }\n\n        digits.insert(1, at: 0)\n        return digits\n    }\n\n}\n```\n\nLet me know in comments if you have any doubts. I will be happy to answer.\n\nPlease upvote if you found the solution useful.
['Swift']