Skip to content

Instantly share code, notes, and snippets.

class Solution {
public:
int lengthOfLastWord(const char *s) {
int n=strlen(s);
int i=n-1,len=0;
if (n==0)
return 0;
while (i>=0) {
class Solution {
public:
vector<int> plusOne(vector<int> &digits) {
int i,inc=0;
digits.back()=digits.back()+1;
if (digits.back() > 9){
inc=1;
digits.back()=digits.back()-10;
i=digits.size()-2;
while (i>=0) {