You are viewing a single comment's thread. Return to all comments →
I want to recieve feedback about my solution in Javascript. How can I do it better?:
function sockMerchant(n, ar) { ar.sort((a, b)=> a - b) let pairs=0; for(let i=0;i<ar.length;i++){ if(ar[i]===ar[i+1]){ pairs++; i++; } } return pairs; }
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 →
I want to recieve feedback about my solution in Javascript. How can I do it better?: