This problem and many others involve building a hash map of (alphabetical) character frequencies. What’s the space complexity of the map?
At first glance it’s constant because there are at most 26 keys, and therefore 26 items, and a constant number of items consumes constant space.
At second glance, if our counts get large, then the space to store those counts will expand, theoretically to log(count) bits. Would the total space complexity would be logn?