-
-
Save tin80122/de4eaa2cb6330ea2c42d2de7bfae85a3 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
var isAnagram = function(s, t) { | |
let s_ary = s.split(''); | |
let t_ary = t.split(''); | |
return JSON.stringify(s_ary.sort()) == JSON.stringify(t_ary.sort()); | |
}; | |
var isAnagram = function(s, t) { | |
if(s.length != t.length) return false; | |
let s_ary = s.split('').sort(); | |
let t_ary = t.split('').sort(); | |
return s_ary.join('') == t_ary.join(''); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment