标签:size while bre leetcode return div style == amp
//如何再vector头部插一个数
class Solution { public: vector<int> plusOne(vector<int>& digits) { int n = digits.size(); int jinwei = 0; digits[n-1] += 1; if(digits[n-1] == 10){ digits[n-1] = 0; jinwei = 1; int i=n-2; while(i >= 0){ digits[i] += 1; if(digits[i] < 10) break; digits[i] %= 10; i--; } } if(digits.front() == 0)digits.insert(digits.begin(),1); return digits; } };
标签:size while bre leetcode return div style == amp
原文地址:https://www.cnblogs.com/cunyusup/p/9765362.html