https://leetcode.cn/problems/find-resultant-array-after-removing-anagrams/description/?languageTags=javascript
/*** @param {string[]} words* @return {string[]}*/
var removeAnagrams = function(words) {let right = 1while (right < words.length) {let preMap = countMap(words[right - 1]),curMap = countMap(words[right])if (check(preMap, curMap)) {words.splice(right, 1)} else {right++}}return words
};// 对字符串中字符个数统计的哈希表
function countMap(word) {let map = new Map()for (let ch of word) {map.set(ch, (map.get(ch) || 0) + 1)}return map
}// 判断两个单词是否为字母异位词
function check(map1, map2) {if (map1.size !== map2.size) return falsefor (let [key, value] of map1) {if (value !== map2.get(key)) return false} return true
}
js哈希模拟,不断删除