Created
June 26, 2017 10:18
-
-
Save belide/7c7e458e893a3815fba146cd6b11cfd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function anagrams(a,b){ | |
var count = 0, isAnagram=false; | |
var a1 = a.split("").sort(); | |
var b1 = b.split("").sort(); | |
for(var i=0;i<a1.length;i++){ | |
if(a1[i] !== b1[i]){ | |
count++; | |
} | |
} | |
if(count===0){ | |
console.log("is Anagram"); | |
} | |
else{ | |
console.log("not Anagram diff is", count); | |
} | |
} | |
anagrams("eedbaasab","aabccddaa"); | |
anagrams("aabccddaa","aabccddaa"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment