Skip to content

Commit fa4dd79

Browse files
authored
Merge pull request #1 from zchoas/zchoas-patch-1
Create 张小胖.md
2 parents e7c6761 + 219c895 commit fa4dd79

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

2018.12.3-leetcode58/张小胖.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution{
2+
public:
3+
int lengthOfLastWorld(string s){
4+
int slength=s.size();
5+
int i=slength-1,length=0;
6+
if(s.size()==0)return 0;
7+
for(i;i>=0;i--)
8+
{
9+
if(s[i]!=' ')
10+
{
11+
break;
12+
}
13+
}
14+
for(i;s[i]!=' '&&i>=0;i--)
15+
{
16+
length++;
17+
}
18+
return length;
19+
}
20+
};

0 commit comments

Comments
 (0)