Cody

Problem 56. Scrabble Scores

Solution 2033232

Submitted on 23 Nov 2019 by Asif Newaz
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))

a10 = 'qz' a8 = 'jx' a5 = 'k' a4 = 'fhvwy' a3 = 'bcmp' a2 = 'dg' a1 = 'aeiounrtsl' v = 1 score = 1

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

a10 = 'qz' a8 = 'jx' a5 = 'k' a4 = 'fhvwy' a3 = 'bcmp' a2 = 'dg' a1 = 'aeiounrtsl' v = 6 score = 3 score = 4 score = 5 score = 6 score = 7 score = 10

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

a10 = 'qz' a8 = 'jx' a5 = 'k' a4 = 'fhvwy' a3 = 'bcmp' a2 = 'dg' a1 = 'aeiounrtsl' v = 12 score = 10 score = 11 score = 12 score = 13 score = 23 score = 24 score = 25 score = 28 score = 29 score = 30 score = 31 score = 32

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

a10 = 'qz' a8 = 'jx' a5 = 'k' a4 = 'fhvwy' a3 = 'bcmp' a2 = 'dg' a1 = 'aeiounrtsl' v = 6 score = 10 score = 11 score = 12 score = 13 score = 14 score = 24

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

a10 = 'qz' a8 = 'jx' a5 = 'k' a4 = 'fhvwy' a3 = 'bcmp' a2 = 'dg' a1 = 'aeiounrtsl' v = 6 score = 8 score = 9 score = 12 score = 17 score = 18 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!