LeetCode #242. Valid Anagram
Time Complexity O(n); Space Complexity O(k) where k ≤ n, worst case O(n) Number of map entries = number of unique characters = k k can range from 1 to n Space complexity: O(k) where k ≤ n So while all n characters are processed, you only store the unique ones with their counts. class…