You are viewing a single comment's thread. Return to all comments →
in JavaScript:
function lonelyinteger(a) { const numOfIncidents = a.reduce((obj, int) => { obj[int] = (obj[int] || 0) + 1; return obj; }, {}); for (let key in numOfIncidents) { if (numOfIncidents[key] === 1){ return parseInt(key); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Lonely Integer
You are viewing a single comment's thread. Return to all comments →
in JavaScript: