πŸ“ Problem Details

πŸ’­What Were My Initial Thoughts?

- we could create a frequency map for each character 
- we could also achieve the same thing by sorting both strings s and t
	- if they are equal, then we know they are anagrams

πŸ’‘ Explanation of Solution

same as intuition

βŒ› Complexity Analysis

Time Complexity: O(n log n)
Space Complexity: O(1)

πŸ’» Implementation of Solution

class Solution {
public:
    bool isAnagram(string s, string t) {
        if(s.size() != t.size()) return false;
 
        sort(s.begin(), s.end());
        sort(t.begin(), t.end());
 
        if(s == t) return true;
 
        return false;
    }
};