← All problems
Plus One (digit array)
Given a non-empty array of digits representing a large non-negative integer, increment it by one and return the resulting digit array. Handle the all-9s carry case.
Complexity
Time O(n), Space O(1) amortized
Common pitfalls
- Forgetting the all-9s expansion
- Converting to int (overflows)
Your solution
Log in to save your code and track progress.