Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

digits =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Add 1 with carry from the end.

Approach

Flip trailing 9s to 0, then increment first non-9. If all were 9, prepend 1.

Code
Loading...
Complexity
Time: O(n)
Space: O(1) extra
Solution
Updated: 2026-02-23

Idea

Add 1 with carry from the end.

Approach

Flip trailing 9s to 0, then increment first non-9. If all were 9, prepend 1.

Code
Loading...
Complexity
Time: O(n)
Space: O(1) extra