1+ import org .junit .jupiter .api .Assertions ;
2+ import org .junit .jupiter .api .Test ;
3+
4+ public class Solution1255Tests {
5+ private final Solution1255 solution1255 = new Solution1255 ();
6+
7+ @ Test
8+ public void example1 () {
9+ String [] words = {"dog" , "cat" , "dad" , "good" };
10+ char [] letters = UtUtils .stringToChars ("""
11+ ["a","a","c","d","d","d","g","o","o"]
12+ """ );
13+ int [] score = {1 , 0 , 9 , 5 , 0 , 0 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
14+ int expected = 23 ;
15+ Assertions .assertEquals (expected , solution1255 .maxScoreWords (words , letters , score ));
16+ }
17+
18+ @ Test
19+ public void example2 () {
20+ String [] words = {"xxxz" , "ax" , "bx" , "cx" };
21+ char [] letters = UtUtils .stringToChars ("""
22+ ["z","a","b","c","x","x","x"]
23+ """ );
24+ int [] score = {4 , 4 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 5 , 0 , 10 };
25+ int expected = 27 ;
26+ Assertions .assertEquals (expected , solution1255 .maxScoreWords (words , letters , score ));
27+ }
28+
29+ @ Test
30+ public void example3 () {
31+ String [] words = {"leetcode" };
32+ char [] letters = UtUtils .stringToChars ("""
33+ ["l","e","t","c","o","d"]
34+ """ );
35+ int [] score = {0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 };
36+ int expected = 0 ;
37+ Assertions .assertEquals (expected , solution1255 .maxScoreWords (words , letters , score ));
38+ }
39+ }
0 commit comments