Cody

Problem 3081. Scrabble Scores - 4

Solution 3025606

Submitted on 2 Oct 2020 by Augusto Mazzei
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
words = {'what','do','you','think','of','this','problem'}; mult = {' D ',' ',' D ',' D t',' ',' D ','t D t'}; score = 148; assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 20 s = 3 s = 12 s = 44 s = 5 s = 14 s = 50

2   Pass
words = {'if','you','like','it','please','give','it','a','like'}; mult = {' D',' Q',' D ',' ',' D t ',' D ','t ',' ','D t'}; score = 113; assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 10 s = 24 s = 16 s = 2 s = 20 s = 16 s = 4 s = 1 s = 20

3   Pass
words = {'zither','quandry','flummox','wealthy','amalgam'}; mult = {' D D','q D ',' D D ',' D D ',' D D '}; score = 368; assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 72 s = 100 s = 84 s = 64 s = 48

4   Pass
words = {'heterogeneous','homogenously','concatenate','thusly','hi'}; mult = {'t t T Q',' t T Q','t t T ','t t ',' '}; score = 690; assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 324 s = 276 s = 69 s = 16 s = 5

5   Pass
words = {'perspicacious','yes','zero','quizzical','no'}; mult = {'t t T Q',' ','t ','t t T ',' '}; score = 671; assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 396 s = 6 s = 33 s = 234 s = 2

6   Pass
words = {'the','quick','brown','fox','jumps','over','a','lazy','dog'}; mult = {'t ',' t ','T Q',' ','t q','t ','t',' T ',' Q'}; score = 278; assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 8 s = 22 s = 120 s = 13 s = 35 s = 9 s = 3 s = 48 s = 20

7   Pass
ind = randi(4); switch ind case 1 words = {'hello','there','fellow','matlab','users'}; mult = {'D d','D d',' D d',' D d','D d'}; score = 106; case 2 words = {'if','you','like','it','please','give','it','a','like'}; mult = {' D',' Q',' D ',' ',' D t ',' D ','t ',' ','D t'}; score = 113; case 3 words = {'heterogeneous','homogenously','concatenate','thusly','hi'}; mult = {'t t T Q',' t T Q','t t T ','t t ',' '}; score = 690; case 4 words = {'the','quick','brown','fox','jumps','over','a','lazy','dog'}; mult = {'t ',' t ','T Q',' ','t q','t ','t',' T ',' Q'}; score = 278; end assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 18 s = 18 s = 32 s = 26 s = 12

8   Pass
ind = randi(4); switch ind case 1 words = {'what','do','you','think','of','this','problem'}; mult = {' D ',' ',' D ',' D t',' ',' D ','t D t'}; score = 148; case 2 words = {'perspicacious','yes','zero','quizzical','no'}; mult = {'t t T Q',' ','t ','t t T ',' '}; score = 671; case 3 words = {'heterogeneous','homogenously','concatenate','thusly','hi'}; mult = {'t t T Q',' t T Q','t t T ','t t ',' '}; score = 690; case 4 words = {'zither','quandry','flummox','wealthy','amalgam'}; mult = {' D D','q D ',' D D ',' D D ',' D D '}; score = 368; end assert(isequal(scrabble_scores_4_rev(words,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 s = 20 s = 3 s = 12 s = 44 s = 5 s = 14 s = 50

Suggested Problems

More from this Author139

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!