Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Soloution is buggy

arya.javadi80

Aug 14, 2023

First of all, If you add a else condition for adding the characters to hashmap, you encounter an error which doesn't make sense, and second why do you initialize the char frequency to a 0 instead of a 1

0

0

Comments
Comments
A
Alfonso Vieyra2 years ago

"second why do you initialize the char frequency to a 0 instead of a 1"

So that we avoid an additional else statement and can proceed to simply add 1.

On this page