about | help | code help+videos | done | prefs |
(MEDIUM) One tool of basic cryptanalysis is determining how frequently any letter occurs in a given passage. From there, one can often determine the characteristics of a substitution cipher. Return the letter and frequency of the most-frequently occurring letter in the input in the form "letter=frequency". If multiple letters have the same highest frequency, return the first of those in the alphabet. Precondition: str will only contain capital letters. HINTYou will probably need multiple loops for this method. Consider what data structure is best to store the frequency information. apcsaEncryptHighestFrequency("AAA") → "A=3" apcsaEncryptHighestFrequency("ABBCCCDDDDEEEEEFFFFFFGGGGGGG") → "G=7" apcsaEncryptHighestFrequency("ZZZAAA") → "A=3" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 350
Copyright Nick Parlante 2017 - privacy