Open
Description
index.ts
export function areAnagrams(s: string, t: string): boolean {
if (s.length !== t.length) {
return false;
}
const sortedS = sortString(s);
const sortedT = sortString(t);
return sortedS === sortedT;
}
function sortString(str: string): string {
return str.split('').sort().join('');
}
Activity