Algorithm · Citadel · Hard
Given a string s and a pattern p, return true if p matches all of s. The pattern uses these wildcard rules: ? matches exactly one character. * matches any sequence of characters, including an empty sequence. Every other character must match the same character in s. A match must consume every character of s; matching only a prefix is not enough. Example 1: Explanation: a matches the first character, * consumes bcde, and f matches the final character. Example 2: Explanation:…