deno.land / x / masx200_leetcode_test@10.6.5 / uncommon-words-from-two-sentences / index.ts
1234567891011121314151617export default function uncommonFromSentences( s1: string, s2: string,): string[] { const a = s1.split(" ");
const b = s2.split(" ");
const cnts = new Map<string, number>();
for (const word of [...a, ...b]) { cnts.set(word, (cnts.get(word) ?? 0) + 1); }
return Array.from(cnts.keys()).filter((k) => 1 === cnts.get(k));}
Version Info