Number-Template Matching with Option Sets

Asked at Vanta · Coding Questions · Difficulty: Medium · Last asked Dec 4, 2024

A template is a list of numeric tokens, and a sentence is a string of words. A template matches a sentence when the tokens can be read as names for the words: wherever a token appears, it must stand for the same word. Build a checker for this rule, then extend it to templates where each position offers a set of allowed tokens and you must pick one token per position.

Loading the problem…