通配符匹配 Wildcard Matching
2018-06-12
通配符匹配问题: https://leetcode.com/problems/wildcard-matching/
Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for ‘?’ and ‘*’.
‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).
The matching should cover the entire input string (not partial).
Note:
s could be empty and contains only lowercase letters a-z. p could be empty and contains only lowercase letters a-z, and characters like ? or *.
待匹配字串 s 中只有字母,模式串中 p 只含有字母和 ?、*,? 匹配任意单个字符,* 匹配任意多个字符(包括空字串),判断字串是否完全匹配。
使用递归算法会超时。
…