Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit c1503b5

Browse files
aQuaaQua
aQua
authored and
aQua
committed
290 accepted.
1 parent 02e3174 commit c1503b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Algorithms/0290.word-pattern/word-pattern.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ func wordPattern(pattern string, str string) bool {
1010
if len(ps) != len(ss) {
1111
return false
1212
}
13-
return match(ps, ss) && match(ss, ps)
13+
return isMatch(ps, ss) && isMatch(ss, ps)
1414
}
1515

16-
func match(s1, s2 []string) bool {
16+
func isMatch(s1, s2 []string) bool {
1717
size := len(s1)
18+
1819
m := make(map[string]string, size)
20+
1921
var i int
2022
var w string
2123
var ok bool
24+
2225
for i = 0; i < size; i++ {
2326
if w, ok = m[s1[i]]; ok {
2427
if w != s2[i] {

0 commit comments

Comments
 (0)