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
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Check whether two strings are anagram of each other
- Python sorted() to check if two strings are anagram or not
- How to check if a key exists in a HashMap in Java
- Longest common anagram subsequence from N strings
- Remove minimum number of characters so that two strings become anagram
- Using Counter() in Python to find minimum character removal to make two strings anagram
- Minimum Number of Manipulations required to make two Strings Anagram Without Deletion of Character
- Check if any anagram of a string is palindrome or not
- Check if binary representations of two numbers are anagram
- Check if binary representation of a given number and its complement are anagram
- Number of sub-strings which are anagram of any sub-string of another string
- HashMap put() Method in Java
- HashMap get() Method in Java
- HashMap and TreeMap in Java
- Traverse through a HashMap in Java
- ArrayList vs. HashMap in Java
- HashMap in Java with Examples
- Hashmap vs WeakHashMap in Java
- Initialize HashMap in Java
- How to Convert HashMap to ArrayList in Java?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.