Problem 1182. Hangman (easy)
What is the best letter to start a hangman game with?
You are given a cell array with all valid N-letter words. Your output should be the letter that has the highest chance of occurring (at least once) within any randomly chosen word in this dictionary.
You can assume that words will always be in all capital letters, and the cell array will always be a row.
Example:
words={'AAA','BED','BEG','BAD'};
You should return letter='B';
note: Letter 'B' occurrs in three different words. Letter 'A', while occurring four times (counting repetitions), only appears in two different words.
Follow-up:
If you are going to be losing hours of sleep over the issue of whether choosing the letter with the highest chance of occurring within any randomly chosen word is actually the best 'simple' strategy in a hangman game, then the next problem in this series - Hangman (strategy) - is for you. Go ahead and test this or a different strategy there, and the contest machinery will score it based on its performance in a series of simulated hangman games.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers48
Suggested Problems
-
Return the largest number that is adjacent to a zero
5392 Solvers
-
Count from 0 to N^M in base N.
235 Solvers
-
Back to basics 13 - Input variables
267 Solvers
-
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
1866 Solvers
-
Convert given decimal number to binary number.
2093 Solvers
More from this Author38
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!