Wildcard Matching

Hard · Dynamic Programming · about 30 minutes

Asked at Google, Amazon, Microsoft, Meta, Bloomberg.

In the pattern p, a '?' matches exactly one character of any kind and a '*' matches any run of characters, empty runs included; every other character must match itself. Decide whether p matches the whole of s.

Related guides