Cody

Problem 56. Scrabble Scores

Solution 2125576

Submitted on 11 Feb 2020 by Diego Saldonid
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))

ans = 1×1 cell array {'a'} array = 1 ans = 1

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

ans = 1×6 cell array {'m'} {'a'} {'t'} {'l'} {'a'} {'b'} array = 3 array = 3 1 array = 3 1 1 array = 3 1 1 1 array = 3 1 1 1 1 array = 3 1 1 1 1 3 ans = 10

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

ans = 1×12 cell array {'q'} {'u'} {'e'} {'t'} {'z'} {'a'} {'l'} {'c'} {'o'} {'a'} {'t'} {'l'} array = 10 array = 10 1 array = 10 1 1 array = 10 1 1 1 array = 10 1 1 1 10 array = 10 1 1 1 10 1 array = 10 1 1 1 10 1 1 array = 10 1 1 1 10 1 1 3 array = 10 1 1 1 10 1 1 3 1 array = 10 1 1 1 10 1 1 3 1 1 array = 10 1 1 1 10 1 1 3 1 1 1 array = 10 1 1 1 10 1 1 3 1 1 1 1 ans = 32

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

ans = 1×6 cell array {'q'} {'u'} {'a'} {'r'} {'t'} {'z'} array = 10 array = 10 1 array = 10 1 1 array = 10 1 1 1 array = 10 1 1 1 1 array = 10 1 1 1 1 10 ans = 24

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

ans = 1×6 cell array {'j'} {'a'} {'c'} {'k'} {'a'} {'l'} array = 8 array = 8 1 array = 8 1 3 array = 8 1 3 5 array = 8 1 3 5 1 array = 8 1 3 5 1 1 ans = 19