← Back to all problems
Easy

Plus One

Updated Feb 24, 2026

Problem

Given digits representing a non-negative integer, return the integer plus one.

Constraints

1 <= digits.length <= 100

Examples

Example 1

Input: {"digits": [1, 2, 3]}
Output: [1, 2, 4]

Function Signature

def plusOne(self, digits: list[int]) -> list[int]

How to Submit

Implement a Solution class with a plusOne method.

Your method will be called with the input parameters and should return the answer.