Anagram
Problem Statement
Given two strings a and b consisting of lowercase characters. The task is 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, act and tac are an anagram of each other.
Example 1
Example 2
Task
You don't need to read input or print anything. Your task is to complete the function isAnagram() which takes the string a and string b as input parameter and check if the two strings are an anagram of each other. The function returns true if the strings are anagram else it returns false.
Expected Time Complexity : O(|a|+|b|).
Expected Auxiliary Space : O(Number of distinct characters).
Constraints :
1 <= |a|, |b| <= 105
0 Comments