Skip to content

Commit 61296e3

Browse files
solves length of last word in python
1 parent 6756c5c commit 61296e3

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Diff for: python/length_of_last_word.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def length_last_word(s: str) -> int:
2+
s = s.strip()
3+
for index in range(len(s) - 1, -1, -1):
4+
if s[index] == ' ':
5+
return len(s) - index - 1
6+
return len(s)
7+
8+
9+
print(length_last_word(input()))

Diff for: src/CountAndSay.java

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import java.util.ArrayList;
22
import java.util.List;
3-
import java.util.Scanner;
43

54
public class CountAndSay {
65
private static String countAndSay(int number) {

Diff for: src/FindModeInBinarySearchTree.java

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class FindModeInBinarySearchTree {
2+
3+
}

0 commit comments

Comments
 (0)