@@ -0,0 +1,1047 @@
+package leetcode;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * https://leetcode.com/problems/word-pattern/%0A */%0Apublic class Problem290 %7B%0A    public boolean wordPattern(String pattern, String str) %7B%0A        Map%3CString, Integer%3E map = new HashMap%3C%3E();%0A        List%3CInteger%3E list1 = new ArrayList%3C%3E();%0A        int i = 0;%0A        for (char c : pattern.toCharArray()) %7B%0A            String s = Character.toString(c);%0A            if (!map.containsKey(s)) %7B%0A                map.put(s, i);%0A                list1.add(i);%0A            %7D else %7B%0A                list1.add(map.get(s));%0A            %7D%0A            i++;%0A        %7D%0A        map.clear();%0A        i = 0;%0A        List%3CInteger%3E list2 = new ArrayList%3C%3E();%0A        for (String s : str.split(%22 %22)) %7B%0A            if (!map.containsKey(s)) %7B%0A                map.put(s, i);%0A                list2.add(i);%0A            %7D else %7B%0A                list2.add(map.get(s));%0A            %7D%0A            i++;%0A        %7D%0A        return list1.equals(list2);%0A    %7D%0A%7D%0A

Solve problem 290