tiles (letters may repeat), and each tile can be used at most once. There is a list of words words; each entry of the list can be laid out at most once.
Letter values come from points, an array of 26 numbers: points[0] is the value of a, points[1] of b, and so on up to z. A word is worth the sum of its letters' values.
Choose a set of words that can all be built together from your tiles so that their total value is as large as possible, and return that value. You do not have to use every tile; an empty set is worth 0.words=['bee', 'tea', 'eat', 'beet'], tiles=['b', 'e', 'e', 't', 'a'], points=[1, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0] → 7
Points: a=1, b=3, e=1, t=2. "beet" scores 3+1+1+2 = 7 and uses every tile except "a". "tea" and "eat" cannot both be built since there is only one "t", and each alone is worth just 4.
words=['ab', 'ab'], tiles=['a', 'b', 'a', 'b'], points=[2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] → 14
These are two separate entries of the list and there are enough tiles for both: 2 · (2 + 5) = 14.
words=['zz'], tiles=['z'], points=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] → 0
"zz" needs two "z" tiles but there is only one. No word can be laid out, so the answer is 0.
tiles is a single letterwords[i] and tiles[i] consist of lowercase English letterswords=['bee', 'tea', 'eat', 'beet'], tiles=['b', 'e', 'e', 't', 'a'], points=[1, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0]
7
Run checks the first 3 tests in your browser. Submit checks all 54 tests on the server, hidden ones included.