File tree Expand file tree Collapse file tree 1 file changed +1
-15
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Original file line number Diff line number Diff line change 5
5
import java .util .Map ;
6
6
import java .util .Set ;
7
7
8
- /**
9
- * 291. Word Pattern II
10
- *
11
- * Given a pattern and a string str, find if str follows the same pattern.
12
- * Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty substring in str.
13
-
14
- Examples:
15
- pattern = "abab", str = "redblueredblue" should return true.
16
- pattern = "aaaa", str = "asdasdasdasd" should return true.
17
- pattern = "aabb", str = "xyzabcxzyabc" should return false.
18
-
19
- Notes:
20
- You may assume both pattern and str contains only lowercase letters.
21
- */
22
8
public class _291 {
23
9
24
10
public static class Solution1 {
@@ -30,7 +16,7 @@ public static class Solution1 {
30
16
* "a" matches "red"
31
17
* "b" matches "blue"
32
18
* then we'll just finish the str check based on this pattern
33
- * * /
19
+ */
34
20
public boolean wordPatternMatch (String pattern , String str ) {
35
21
Map <Character , String > map = new HashMap ();
36
22
Set <String > set = new HashSet ();
You can’t perform that action at this time.
0 commit comments