LeetCode 242 Valid Anagram
概述
https://leetcode.com/problems/valid-anagram/
单哈希表法
class Solution {
public:
    bool isAnagram(string s, string t) {
        unordered_map<char, int> m;
        if (s.size() != t.size()) return false;
        for (int i = 0; i < s.size(); i ++) {
            m[s[i]] ++;
            m[t[i]] --;
            if (m[s[i]] == 0) m.erase(s[i]);
            if (m[t[i]] == 0) m.erase(t[i]);
        }
        return m.empty();
    }
};
Links: leetcode-242-valid-anagram