Search⌘ K
AI Features

Wildcard Matching

Explore how to implement a wildcard matching algorithm that supports '?' for single characters and '*' for any sequence, ensuring the pattern matches the entire input string. Understand the problem constraints and practice solving it using greedy techniques for efficient string pattern matching in coding interviews.

Statement

Given an input string, s, and a pattern string, p, implement wildcard pattern matching that determines if the pattern matches the entire input string.

The pattern supports two special wildcard characters:

  • '?': Matches exactly one arbitrary character.

  • '*': Matches any sequence of characters (including zero characters).

The match must be complete, meaning the pattern should cover the entire input string, not just a part of it. ...