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 2275e94 commit 9b78973Copy full SHA for 9b78973
javascript/242-Valid-Anagram.js
@@ -4,33 +4,6 @@
4
* @return {boolean}
5
*/
6
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
27
28
29
30
31
- return true;
32
33
- //solution 2
34
if(s.length !== t.length) {
35
return false;
36
}
0 commit comments