Leetcode 66. Plus One | | Leetcode 66. Plus One 文章作者:Tyan博客:noahsnail.com | CSDN | 简书 1. Description 2. Solution1234567891011121314151617181920class Solution {public: vector<int> plusOne(vector<int>& digits) { int length = digits.size(); int index = length - 1; while(index >= 0) { int sum = digits[index] + 1; if(sum == 10) { digits[index] = 0; index--; } else { digits[index] = sum; return digits; } } digits.insert(digits.begin(), 1); return digits; }}; Reference https://leetcode.com/problems/plus-one/description/ 如果有收获,可以请我喝杯咖啡! 赏 微信打赏 支付宝打赏