52. 正则表达式匹配
文章目录 题目描述 1. 递归 代码实现 2. dp自顶向下备忘录 代码实现 复杂度分析 3. dp自底向上 代码实现 复杂度分析 题目描述 1. 递归 代码实现 /** * @Classname Solution * @Description 正则表达式匹配 * @Date 2019/12/24 10:45 * @Author SonnSei */ public class Solution { public static boolean match ( char [ ] str , char [ ] pattern ) { if ( str == null || pattern == null ) return false ; return match ( str , 0 , pattern , 0 ) ; } private static boolean match ( char [ ] str , int sIndex , char [ ] pattern , int pIndex ) { if ( pIndex == pattern . length ) return sIndex == str . length ; boolean firstMatch = sIndex < str . length && ( str [ sIndex ] == pattern [