Skip to content

Commit 4277e23

Browse files
committed
Dome with daily 3
1 parent a19adbc commit 4277e23

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

58. Length of Last Word.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution(object):
2+
def lengthOfLastWord(self, s):
3+
"""
4+
:type s: str
5+
:rtype: int
6+
"""
7+
8+
s = strip(s)
9+
s = s[::-1]
10+
for i in range(len(s)):
11+
if s[i]==" ":
12+
return i
13+
return len(s)

0 commit comments

Comments
 (0)