Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b78973

Browse files
authored
Remove duplicate solution
1 parent 2275e94 commit 9b78973

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

javascript/242-Valid-Anagram.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,6 @@
44
* @return {boolean}
55
*/
66
var isAnagram = function(s, t) {
7-
8-
//solution 1
9-
let map = {};
10-
11-
if (s.length !== t.length) {
12-
return false;
13-
}
14-
15-
for (let i = 0; i < s.length; i++) {
16-
if (map[s[i]]) {
17-
map[s[i]]++;
18-
} else {
19-
map[s[i]] = 1;
20-
}
21-
}
22-
23-
for (let i = 0; i < t.length; i++) {
24-
if (map[t[i]]) {
25-
map[t[i]]--;
26-
} else {
27-
return false;
28-
}
29-
}
30-
31-
return true;
32-
33-
//solution 2
347
if(s.length !== t.length) {
358
return false;
369
}

0 commit comments

Comments
 (0)