match_pattern(pattern: int[], candidate: string) -> bool: You are given a sequence of numbers and a candidate string of words. Determine whether a consistent mapping exists between the numbers and the words. The rule is: each number maps to exactly one word, but the same word may be mapped by multiple different numbers. (Confirm this direction with your interviewer — some interviewers state it the reverse way.)match_meta_pattern(metapattern: int[][], candidate: string) -> bool: Each position now contains a list of allowed numbers instead of a single number. Choose one number from each position's list so that the resulting flat pattern is a valid match_pattern. Return whether any such choice exists.[[1], [1, 2]], "dog cat" -> true
[[1, 2], [2], [1, 2]], "ant cat falcon" -> false
[[1, 2], [1], [1, 2]], "dog cat cat" -> true
[[1], [1, 2], [2, 500]], "cat dog cat" -> true
[[1], [1, 2]], "dog cat" is true because choosing 2 at the second position produces [1, 2], with 1 -> dog and 2 -> cat.[[1, 2], [2], [1, 2]], "ant cat falcon" is false: every possible choice forces at least one number to map to two different words.[[1, 2], [1], [1, 2]], "dog cat cat" is true by selecting [2, 1, 1]; then 2 -> dog and 1 -> cat, with the same word cat appearing twice.[[1], [1, 2], [2, 500]], "cat dog cat" is true by selecting [1, 2, 500]; numbers 1 and 500 both map to cat, which is allowed.[1,2,1,2] / "dog cat dog cat" -> true: number 1 consistently maps to dog, and 2 to cat.[1,2,1,2] / "dog cat pig cat" -> false: number 1 would need to map to both dog and pig.[1,2,3,4] / "dog dog cat cat" -> true: multiple numbers may point to the same word.The real difficulty is the mapping rule itself: one number must be tied to exactly one word, while the same word may receive multiple numbers. If the rule is reversed or made bijective, the problem is different.