44. Wildcard Matching Hard
1/**
2 * [44] Wildcard Matching
3 *
4 * Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where:
5 *
6 * '?' Matches any single character.
7 * '*' Matches any sequence of characters (including the empty sequence).
8 *
9 * The matching should cover the entire input string (not partial).
10 *
11 * Example 1:
12 *
13 * Input: s = "aa", p = "a"
14 * Output: false
15 * Explanation: "a" does not match the entire string "aa".
16 *
17 * Example 2:
18 *
19 * Input: s = "aa", p = "*"
20 * Output: true
21 * Explanation: '*' matches any sequence.
22 *
23 * Example 3:
24 *
25 * Input: s = "cb", p = "?a"
26 * Output: false
27 * Explanation: '?' matches 'c', but the second letter is 'a', which does not match 'b'.
28 *
29 *
30 * Constraints:
31 *
32 * 0 <= s.length, p.length <= 2000
33 * s contains only lowercase English letters.
34 * p contains only lowercase English letters, '?' or '*'.
35 *
36 */
37pub struct Solution {}
38
39// problem: https://leetcode.com/problems/wildcard-matching/
40// discuss: https://leetcode.com/problems/wildcard-matching/discuss/?currentPage=1&orderBy=most_votes&query=
41
42// submission codes start here
43
44impl Solution {
45 pub fn is_match(s: String, p: String) -> bool {
46 false
47 }
48}
49
50// submission codes end
51
52#[cfg(test)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn test_44() {
58 }
59}
60
Back
© 2025 bowen.ge All Rights Reserved.