Valid Anagram

Hashing, Sorting, and Parsing DSA practice problem on Onlearn.

Difficulty: medium.

Topics: Check if two strings are anagrams of each other, Strings, Sorting, Frequency Counting, Time Complexity, Space Complexity, Arrays, String Manipulation, string properties, space complexity, string manipulation, sorting algorithms, frequency counting, time complexity analysis, Anagrams.

Given two strings, determine if they are anagrams of each other. Two strings are anagrams if they contain the same characters with the same frequency. For example, "CAT" and "ACT" are anagrams because they both contain one 'C', one 'A', and one 'T'. Input: Two strings, str1 and str2. Output: Return true if the strings are anagrams, false otherwise. Examples: Example 1: Input: str1 = "CAT" str2 = "ACT" Output: true Explanation: Since the count of every letter of both strings are equal. Example 2: Input: str1 = "RULES" str2 = "LESRT" Output: false Explanation: Since the count of U and T is not equal in both strings.