Character Frequency
Learn Character Frequency (Strings, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Counting Character Occurrences A huge fraction of string problems (anagrams, first-unique-character, valid-anagram-window) start with a frequency count. For ASCII/lowercase-letter input, a fixed-size int[26] array is faster than a HashMap - no hashing/boxing overhead, direct index access via c - 'a' .