Cody

Problem 42. Find the alphabetic word product

Solution 2115786

Submitted on 3 Feb 2020 by Ishan Fernando
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
s = 'hello' c_correct = 86400; assert(isequal(word_product(s),c_correct))

s = 'hello' letter = 'h' x = 8 z = 8 product = 8 p = 8 letter = 'e' x = 5 z = 5 product = 40 p = 40 letter = 'l' x = 12 z = 12 product = 480 p = 480 letter = 'l' x = 12 z = 12 product = 5760 p = 5760 letter = 'o' x = 15 z = 15 product = 86400 p = 86400

2   Pass
s = 'Fantastic' c_correct = 17236800; assert(isequal(word_product(s),c_correct))

s = 'Fantastic' letter = 'f' x = 6 z = 6 product = 6 p = 6 letter = 'a' x = 1 z = 1 product = 6 p = 6 letter = 'n' x = 14 z = 14 product = 84 p = 84 letter = 't' x = 20 z = 20 product = 1680 p = 1680 letter = 'a' x = 1 z = 1 product = 1680 p = 1680 letter = 's' x = 19 z = 19 product = 31920 p = 31920 letter = 't' x = 20 z = 20 product = 638400 p = 638400 letter = 'i' x = 9 z = 9 product = 5745600 p = 5745600 letter = 'c' x = 3 z = 3 product = 17236800 p = 17236800

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!