Skip to content

Commit 629ad80

Browse files
committed
Use None to remove empty strings
1 parent 80be243 commit 629ad80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Reverse Words in a String.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Solution:
22
def reverseWords(self, s):
3-
return " ".join(filter(lambda x: x, reversed(s.split(" "))))
3+
return " ".join(filter(None, reversed(s.split(" "))))

0 commit comments

Comments
 (0)