From 7c5c3cfc61dcdc8423c35207b0234b2f2915452d Mon Sep 17 00:00:00 2001 From: wogha95 Date: Sun, 18 Aug 2024 12:04:33 +0900 Subject: [PATCH] solve: valid anagram --- valid-anagram/wogha95.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 valid-anagram/wogha95.js diff --git a/valid-anagram/wogha95.js b/valid-anagram/wogha95.js new file mode 100644 index 000000000..90b723358 --- /dev/null +++ b/valid-anagram/wogha95.js @@ -0,0 +1,11 @@ +// TC: O(N * log N) +// SC: O(N) + +/** + * @param {string} s + * @param {string} t + * @return {boolean} + */ +var isAnagram = function(s, t) { + return s.split('').sort().join('') === t.split('').sort().join(''); +}; \ No newline at end of file