r/codinginterview • • Jul 05 '20

Anagram

https://youtu.be/Uy3sS6gs3HE
4 Upvotes

3 comments sorted by

1

u/jiibo_j Jul 05 '20

we can use hash map and if they are in both string the value of each key will be a minimum of 2 , so if we loop through the map and we find any key that it’s value is 1 then we know it’s not an anagram.

1

u/bparanj Jul 05 '20

What is the advantage of using the Hashmap for this problem?

1

u/jiibo_j Jul 06 '20

there’s no real adv, it’s just another way to solve the problem.