#197 Letter Frequency Dictionary

Companies:
Digitalleague
Themes:
AlgorithmsStringsHash TablesPractice

Build a frequency dictionary for letters of the Russian or English alphabet. The problem of selecting and analyzing a language corpus can be omitted; a short text is sufficient.

public class Main {

    /**
     * Example:
     * Input text: Build a frequency dictionary of letters in the Russian (or English) alphabet.
     * Result:
     * a 5
     * b 2
     * c 2
     * d 2
     * e 7
     * f 2
     * g 1
     * h 3
     * i 6
     * l 4
     * n 5
     * o 3
     * p 1
     * q 1
     * r 5
     * s 4
     * t 5
     * u 3
     * y 2
     *
     * @param text - input text
     * @return an associative array of character frequencies
     */
    public Map<Character, Integer> buildDictionaryWithMap(String text) {
        throw new UnsupportedOperationException("Implemented it!");
    }

    public static void main(String... args) {

    }
}

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in