Pergunta de entrevista da empresa PayU

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

Respostas da entrevista

Sigiloso

16 de jun. de 2022

I used Hashset.

Sigiloso

8 de ago. de 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; }