Skip to content

Added three more approaches in anagram.java #3370

@Anshumanshukla46

Description

@Anshumanshukla46

First approach (5): Here, I have used a HashMap and once the element is found in s frequency have increased by 1 and when found in frequency have decreased by 1.
Second approach (6): Here, I have used an array of size 26 where I increase the counter by 1 if found in s and decreased by 1 if found in t. If somehow it went in negative, I simply return false.
Third approach (7): Here, I have used an array of size 256 which have the ability to deal with all Unicode characters.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions