Skip to content

Instantly share code, notes, and snippets.

View LengthOfLastWord
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) {
View PlusOne
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) {
You can’t perform that action at this time.