When you’re given an array of characters, and your first step is “I’m going to store that in a map of (int , int) -> char” I think you need to question your methods.
Why? They immediately explain that the difference in performance would not be significant on such a small problem and I see no other reason to prefer arrays over maps.
When you’re given an array of characters, and your first step is “I’m going to store that in a
map
of(int , int) -> char
” I think you need to question your methods.Why? They immediately explain that the difference in performance would not be significant on such a small problem and I see no other reason to prefer arrays over maps.