一行解决。利用库函数
正则表达式匹配
http://www.nowcoder.com/questionTerminal/45327ae22b7b413ea21df13ee7d6429c
本来我也是分情况讨论的,但后来绕晕了而且还有数组越界异常,就全删了,然后想起来直接利用库函数正则表达式匹配把,就去复习了一下
public class Solution { public boolean match(char[] str, char[] pattern) { return new String(str).matches(new String(pattern)); } }