Cody

Problem 56. Scrabble Scores

Solution 1608281

Submitted on 13 Aug 2018 by Ben Cappello
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
str = 'a'; score = 1; assert(isequal(scrabble_score(str),score))

a = 'aeiounrtlsdgbcmpfhvwykjxqz' b = '11111111112233334444458899' q = 1 score = 1

2   Pass
str = 'matlab'; score = 10; assert(isequal(scrabble_score(str),score))

a = 'aeiounrtlsdgbcmpfhvwykjxqz' b = '11111111112233334444458899' q = 15 score = 3 q = 1 score = 4 q = 8 score = 5 q = 9 score = 6 q = 1 score = 7 q = 13 score = 10

3   Pass
str = 'quetzalcoatl'; score = 32; assert(isequal(scrabble_score(str),score))

a = 'aeiounrtlsdgbcmpfhvwykjxqz' b = '11111111112233334444458899' q = 25 score = 10 q = 5 score = 11 q = 2 score = 12 q = 8 score = 13 q = 26 score = 23 q = 1 score = 24 q = 9 score = 25 q = 14 score = 28 q = 4 score = 29 q = 1 score = 30 q = 8 score = 31 q = 9 score = 32

4   Pass
str = 'quartz'; score = 24; assert(isequal(scrabble_score(str),score))

a = 'aeiounrtlsdgbcmpfhvwykjxqz' b = '11111111112233334444458899' q = 25 score = 10 q = 5 score = 11 q = 1 score = 12 q = 7 score = 13 q = 8 score = 14 q = 26 score = 24

5   Pass
str = 'jackal'; score = 19; assert(isequal(scrabble_score(str),score))

a = 'aeiounrtlsdgbcmpfhvwykjxqz' b = '11111111112233334444458899' q = 23 score = 8 q = 1 score = 9 q = 14 score = 12 q = 22 score = 17 q = 1 score = 18 q = 9 score = 19

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!