We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f15f93e commit ee9652aCopy full SHA for ee9652a
python/hash-table/word-pattern[1].py
@@ -0,0 +1,9 @@
1
+class Solution(object):
2
+ def wordPattern(self, pattern, str):
3
+ """
4
+ :type pattern: str
5
+ :type str: str
6
+ :rtype: bool
7
8
+ words = str.split()
9
+ return map(pattern.find, pattern) == map(words.index, words)
0 commit comments