Skip to content

Instantly share code, notes, and snippets.

@pitsanujiw
Created January 11, 2021 09:58
Show Gist options
  • Save pitsanujiw/ed415a2272c69086d2bba175f7084880 to your computer and use it in GitHub Desktop.
Save pitsanujiw/ed415a2272c69086d2bba175f7084880 to your computer and use it in GitHub Desktop.
function isAnagram(s, t) {
let ss =s.split('').sort();
let tt = t.split('').sort();
if (s.length != t.length) return false;
for (let i = 0; i < s.length; i++) {
if (ss[i] != tt[i]) {
return false;
}
}
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment