/**
* @param {string} s
* @param {string} t
* @return {boolean}
*/
var isAnagram = function (s, t) {
// 采用字符串
// return s.length == t.length && [...s].sort().join('') === [...t].sort().join('')
// 采用数组哈希表
if (s.length !== t.length) return false;
const resSet = new Array(26).fill(0);
const base = "a".charCodeAt();
for (const i of s) {
resSet[i.charCodeAt() - base]++;
}
for (const i of t) {
if (!resSet[i.charCodeAt() - base]) return false;
resSet[i.charCodeAt() - base]--;
}
return true;
};