MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / groupAnagrams

Function groupAnagrams

javascript/0049-group-anagrams.js:9–15  ·  view source on GitHub ↗
(words, map = new Map())

Source from the content-addressed store, hash-verified

7 * @return {string[][]}
8 */
9var groupAnagrams = (words, map = new Map()) => {
10 if (!words.length) return [];
11
12 groupWords(words, map); /* Time O(N * (K * log(K)) | Space O(N * K) */
13
14 return [...map.values()]; /* Time O(N) | Space O(N * K) */
15};
16
17var groupWords = (words, map) => {
18 for (const original of words) {

Callers

nothing calls this directly

Calls 1

groupWordsFunction · 0.85

Tested by

no test coverage detected