You are viewing a single comment's thread. Return to all comments →
efficient JavaScript solution using bitwise logic:
function sockMerchant(n, ar) { var sum = 0; var numberOfColors = Array(101); ar.forEach((color) => { sum += 1 & numberOfColors[color]; numberOfColors[color] = !numberOfColors[color]; }) return sum; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →
efficient JavaScript solution using bitwise logic: