You are viewing a single comment's thread. Return to all comments →
This is my solution in JS:
function sockMerchant(n, ar) { let pairCounter=0; while(ar.length>1){ let color= ar.shift(); for(let i=0; i<ar.length; i++){ if(color===ar[i]) { pairCounter++; ar.splice(i,1); break; } } } return pairCounter; }
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 →
This is my solution in JS: