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

Function reorder

javascript/0242-valid-anagram.js:16–22  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

14};
15
16const reorder = (str) =>
17 str
18 .split('') /* Time O(N) | Space O(N) */
19 .sort((a, b) =>
20 a.localeCompare(b),
21 ) /* Time O(N * log(N)) | Space O(1 || log(N)) */
22 .join(''); /* Time O(N) | Space O(N) */
23
24/**
25 * Hash Map - Frequency Counter

Callers 1

isAnagramFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected