Skip to content

Commit

Permalink
Create split-strings-by-separator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Jul 23, 2023
1 parent 8c8187b commit eb39640
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Python/split-strings-by-separator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Time: O(n * l)
# Space: O(l)

# string
class Solution(object):
def splitWordsBySeparator(self, words, separator):
"""
:type words: List[str]
:type separator: str
:rtype: List[str]
"""
return [w for word in words for w in word.split(separator) if w]

0 comments on commit eb39640

Please sign in to comment.