Cody

# Problem 56. Scrabble Scores

Solution 227080

Submitted on 4 Apr 2013
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   Fail
%% str = 'a'; score = 1; assert(isequal(scrabble_score(str),score))

ans = @(y)sum(arrayfun(@(x)containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).values{find(cell2mat(containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).keys)==x)},y))

Invalid input for argument 2 (keySet): Value must be 'cell'.

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

ans = @(y)sum(arrayfun(@(x)containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).values{find(cell2mat(containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).keys)==x)},y))

Invalid input for argument 2 (keySet): Value must be 'cell'.

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

ans = @(y)sum(arrayfun(@(x)containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).values{find(cell2mat(containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).keys)==x)},y))

Invalid input for argument 2 (keySet): Value must be 'cell'.

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

ans = @(y)sum(arrayfun(@(x)containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).values{find(cell2mat(containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).keys)==x)},y))

Invalid input for argument 2 (keySet): Value must be 'cell'.

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

ans = @(y)sum(arrayfun(@(x)containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).values{find(cell2mat(containers.Map({'a','e','i','o','n','r','t','l','s','u','d','g','b','c','m','p','f','h','v','w','y','k','j','x','q','z'},{1,1,1,1,1,1,1,1,1,1,2,2,3,3,3,3,4,4,4,4,4,5,8,8,10,10}).keys)==x)},y))

Invalid input for argument 2 (keySet): Value must be 'cell'.