deno.land / x / masx200_leetcode_test@10.6.5 / find-the-difference / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
export default function findTheDifference(s: string, t: string): string { const cnt = new Map<string, number>();
Array.prototype.forEach.call(t, (v) => cnt.set(v, 1 + (cnt.get(v) || 0)));
Array.prototype.forEach.call(s, (v) => cnt.set(v, -1 + (cnt.get(v) || 0)));
return [...cnt.entries()].filter((a) => a[1])[0][0];}
masx200_leetcode_test

Version Info

Tagged at
a year ago