Problems

7. Plus One

EasyArrayGoogleMicrosoft

A non-negative integer is represented by the array digits. Add one to the integer and return the resulting digits.

Example 1:

Input: digits = [1,2,3]
Output: [1,2,4]

Example 2:

Input: digits = [9]
Output: [1,0]

Constraints:

  • 1 <= digits.length <= 100
Core code mode
● Auto-savedLine 1, column 1