(String s, String p)
| 1 | class Solution { |
| 2 | |
| 3 | public boolean isMatch(String s, String p) { |
| 4 | boolean[][] cache = new boolean[s.length() + 1][p.length() + 1]; |
| 5 | |
| 6 | return dfs(cache, s, p, 0, 0); |
| 7 | } |
| 8 | |
| 9 | private boolean dfs(boolean[][] cache, String s, String p, int i, int j) { |
| 10 | if (cache[i][j] != false) return cache[i][j]; |