Maximum word score
Your task
Given a list of words, a multiset of available letters (lowercase), and a score array of length 26 where score[i] is the value of letter 'a'+i, choose a subset of words to maximize the total score. A word scores the sum of its letters' scores, but you can only use each available letter once across all chosen words (a word can only be used if you have all its letters remaining). Return the maximum achievable score. 1 <= len(words) <= 14.
Examples
max_score_words(words: list[str], letters: list[str], score: list[int]) -> intExample 1
Input
max_score_words(["dog", "cat", "dad", "good"], ["a", "a", "c", "d", "d", "d", "g", "o", "o"], [1, 0, 9, 5, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])Output
19