You are viewing a single comment's thread. Return to all comments →
Javascript doesn't have a native set intersect function so you just have to roll your own:
function gemstones(arr) { const s = arr.reduce((a, c) => { return new Set([...a].filter(x =>[...c].includes(x))); }); return [...s].length; }
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
Javascript doesn't have a native set intersect function so you just have to roll your own: