2dbi
Home/MongoDB/Intersection of Two Sets / Regex-Like Matcher
MMongoDB·DSAEngineerOnsite – Coding 1

Intersection of Two Sets / Regex-Like Matcher

Problem

Implement set intersection over large inputs, then a simplified regex matcher supporting '.' and '*'.

Example

isMatch("aab", "c*a*b") -> true

Constraints

  • Inputs may be large

Approach

Hashing for intersection; DP for the matcher. Both reported at MongoDB.

added 6 days ago
LeadersAccount