Plus One

You are given a large integer represented as an integer array where each element is a digit of the integer, ordered from most significant to least significant. The task is to increment the large integer by one and return the resulting array of digits.

Constraints

  • 1 <= digits.length <= 100
  • 0 <= digits[i] <= 9
  • digits does not contain any leading 0's.
Saving… · 2 lines
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
Console

Click Run to execute sample tests.