NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

Given a string pattern representing a search pattern (which may include the wildcard character '*'), and a string str representing the input sequence.

The wildcard '*' in pattern can match zero or more arbitrary characters in str. All other characters in pattern must appear in str in the same order. Return the first starting index (0-based) in str where the pattern matches. If there is no such match, return -1.

Test Cases
Input
Output
Expected