Skip to content

Commit aed3792

Browse files
authored
Create TheRocket.md
1 parent 733f6d7 commit aed3792

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

2018.12.3-leetcode58/TheRocket.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
```java
2+
class Solution {
3+
public int lengthOfLastWord(String s) {
4+
int res = 0;
5+
int i = s.length() - 1;
6+
for (; i >= 0 && s.charAt(i) == ' '; --i);
7+
for (; i >= 0 && s.charAt(i) != ' '; --i) {
8+
++res;
9+
}
10+
return res;
11+
}
12+
}
13+
```

0 commit comments

Comments
 (0)