44. Wildcard Matching

Description

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).

Constraints

  • s could be empty or contains only lowercase letters a-z.

  • p could be empty or contains only lowercase letters a-z, and characters like ? or *.

Approach

Examples

Input: s = "aa", p = "a"

Output: false

Explanation: "a" does not match the entire string "aa".

Solutions

Follow up

  • Count the Number of matching characters in a pair of strings - GFG

Last updated

Was this helpful?