public class Solution { public boolean isMatch(String s, String p) { int sLen = s.length(), pLen = p.length(); int i = 0, j = 0; int ss = 0, starP = -1; while (i < sLen) { while(j < pLen && p.charAt(j) == ‘*‘){ starP = j++; ss = i; } if((j == pLen) || (s.charAt(i) != p.charAt(j) && p.charAt(j) != ‘?‘)){ if(starP < 0){ return false; } else { j = starP + 1; i = ++ss; } } else{ i++; j++; } } while (j < pLen && p.charAt(j) == ‘*‘) { j++; } return j == pLen; } }
相关文章
- 11-25leetcode 165. Compare Version Numbers
- 11-25【LeetCode】3. Longest Substring Without Repeating Characters
- 11-25LeetCode 第 165 场周赛
- 11-25[LeetCode] 1376. Time Needed to Inform All Employees
- 11-25LeetCode每日一题——690. 员工的重要性
- 11-25第一次leetcode周赛总结
- 11-25LeetCode(7) - Reverse Integer
- 11-25[Leetcode]19.把数组排成最小的数
- 11-25LeetCode --- 字符串系列 --- 转换成小写字母
- 11-25leetcode283. 移动零