C++ Most optimal solution----->0ms and less memory
\nclass Solution {\npublic:\n    vector<int> plusOne(vector<int>& digits) {\n        int s=digits.size()-1;    //Length of the vector \n        while(s>=0){\n  
```\nclass Solution {\npublic:\n    vector<int> plusOne(vector<int>& digits) {\n        int s=digits.size()-1;    //Length of the vector \n        while(s>=0){\n            if(digits[s]<9){\n                digits[s]+=1;\n                return digits;\n            }\n            else{\n                digits[s]=0;\n                s--;\n            }\n        }\n        vector<int> :: iterator iter=digits.begin();   //Inserting 1 if incase the number is [9],[9,9,9,9] etc\n        digits.insert(iter,1);\n        return digits;\n    }\n};\n```\n\nPlease upvote if found useful!
[]