Find the Substring

Problem Overview

  • Determine the zero-based index of the first occurrence of pattern x in string s, where x may include a single wildcard * matching any one character.
  • Input: s (lowercase a–z) and x (lowercase with at most one *). Output: integer index or -1 if not found.
  • Domain: text processing/string search; classic problem for a coding interview.
  • Source: Asked in LinkedIn interviews; a practical interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: