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

Function isAnagram

javascript/0242-valid-anagram.js:9–14  ·  view source on GitHub ↗
(s, t)

Source from the content-addressed store, hash-verified

7 * @return {boolean}
8 */
9var isAnagram = (s, t) => {
10 const isEqual = s.length === t.length;
11 if (!isEqual) return false;
12
13 return reorder(s) === reorder(t); /* Time O(N * logN) | Space O(N) */
14};
15
16const reorder = (str) =>
17 str

Callers

nothing calls this directly

Calls 4

addFrequencyFunction · 0.85
subtractFrequencyFunction · 0.85
checkFrequencyFunction · 0.85
reorderFunction · 0.70

Tested by

no test coverage detected