Check whether two Strings are Anagram of each other using HashMap in Java
Write a function to check whether two given strings are an Anagram of each other or not.
An anagram of a string is another string that contains the same characters, only the order of characters can be different.
For example, “abcd” and “dabc” are an Anagram of each other.
Approach: Hashmaps can also be used to find if any two given strings are anagrams or not, by mapping the characters of each string to individual hashmaps and comparing them together.
Strings to be checked are: geeksforgeeks forgeeksgeeks The two strings are anagrams of each other Strings to be checked are: geeksforgeeks geeks The two strings are not anagram of each other
Related Article: Check whether two strings are anagram of each other