Skip to content

Commit 2f830f3

Browse files
authored
Create check-if-a-string-is-an-acronym-of-words.py
1 parent 55888f0 commit 2f830f3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
import itertools
5+
6+
7+
# string
8+
class Solution(object):
9+
def isAcronym(self, words, s):
10+
"""
11+
:type words: List[str]
12+
:type s: str
13+
:rtype: bool
14+
"""
15+
return len(words) == len(s) and all(w[0] == c for w, c in itertools.izip(words, s))

0 commit comments

Comments
 (0)