Is Regex Matching

Problem Overview

  • Determine for each string whether it matches a simplified regex, returning YES or NO.
  • Input: a regex over lowercase letters with '.', '*', and parentheses, and an array arr of k lowercase strings. Output: array of YES/NO.
  • Rules: '.' matches one letter; 'X*' matches zero or more; '(...)' is a group with no nested brackets, contains no '', and is always followed by ''.
  • Real-world context: NLP regex library at Amazon; asked in Amazon interviews as a coding interview problem and 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: