题加专题

Java | Leetcode Java题解之第66题加一

题目: 题解: class Solution {public int[] plusOne(int[] digits) {int n = digits.length;for (int i = n - 1; i >= 0; --i) {if (digits[i] != 9) {++digits[i];for (int j = i + 1; j < n; ++j) {digits[j] = 0;

C语言 | Leetcode C语言题解之第66题加一

题目: 题解: /*** Note: The returned array must be malloced, assume caller calls free().*/int* plusOne(int* digits, int digitsSize, int* returnSize){for(int i = digitsSize - 1; i >= 0; --i){digits[i]

Python | Leetcode Python题解之第66题加一

题目: 题解: class Solution:def plusOne(self, digits: List[int]) -> List[int]:n = len(digits)for i in range(n - 1, -1, -1):if digits[i] != 9:digits[i] += 1for j in range(i + 1, n):digits[j] = 0return d

Golang | Leetcode Golang题解之第66题加一

题目: 题解: func plusOne(digits []int) []int {n := len(digits)for i := n - 1; i >= 0; i-- {if digits[i] != 9 {digits[i]++for j := i + 1; j < n; j++ {digits[j] = 0}return digits}}// digits 中所有的元素均为 9di