66. Plus One

Practice Plus One for free on NudgeCode: Easy, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

digits holds the decimal digits of a non-negative integer, most significant digit first, with no leading zeros (except the number 0 itself). Add one to the number and return its digits in the same form.

Example

digits = [9,9,9]  ->  [1,0,0,0]

Constraints