Frage im Vorstellungsgespräch bei PayU

In initial two rounds I was asked to remove all the duplicate elements from string array.

Antworten zu Vorstellungsgespräch

Anonym

16. Juni 2022

I used Hashset.

Anonym

8. Aug. 2022

const removeDup = (arr) => { const out = []; const newSet = new Set(); for(elem of arr) { if(!newSet.has(elem)) { newSet.add(elem); out.push(elem); } } return out; }