We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1eeeb32 commit cee6cc2Copy full SHA for cee6cc2
valid-anagram/Kyojin-Hwang.js
@@ -0,0 +1,21 @@
1
+/**
2
+ * @param {string} s
3
+ * @param {string} t
4
+ * @return {boolean}
5
+ */
6
+var isAnagram = function(s, t) {
7
+ if (s.length !== t.length) return false;
8
+
9
+ const count = {};
10
11
+ for (let char of s) {
12
+ count[char] = (count[char] || 0) + 1;
13
+ }
14
15
+ for (let char of t) {
16
+ if (!count[char]) return false; // 없거나 개수가 0
17
+ count[char]--;
18
19
20
+ return true;
21
+};
0 commit comments