Algorithm · Airbnb · Medium
Problem: Label Text Substrings with Pattern Tags Given a string text and a collection of patterns with metadata, locate the eligible pattern occurrences and report the chosen tag for each selected substring. Every pattern provides: tag: the label to emit when the pattern is selected; priority: an integer rank, where a greater number wins; pattern: the literal text to search for, including any spaces it contains. Apply these rules while matching: Comparisons must be exact and…