Counting letter frequency in array in O(1) with hash function
The complexity is $O(n)$. What is $O(1)$ is the time it takes to access a cell in the hash table.
By the way, assuming that each character is a byte, you can just use a plain old array of length 256.