https://leetcode.com/problems/plus-one/
class Solution { public: vector<int> plusOne(vector<int>& digits) { int size=digits.size(); vector<int>::iterator theIterator = digits.begin(); int temp; int carry=0; for(int i=size-1;i>=0;i--) { if(i==size-1||carry==1) { temp=digits[i]+1; carry=temp/10; digits[i]=temp%10; } else break; } if(carry==1) digits.insert(theIterator,1,1); return digits; } };