Pergunta de entrevista da empresa FINRA

some basic SQL and Java questions and a lot of whiteboard questions, how would you remove non repeating chars from String

Resposta da entrevista

Sigiloso

31 de out. de 2022

const str = 'teeth_foot'; const removeNonDuplicate = str => { const strArray = str.split(""); const duplicateArray = strArray.filter(el => { return strArray.indexOf(el) !== strArray.lastIndexOf(el); }); return duplicateArray.join(""); }; console.log(removeNonDuplicate(str));

1