You are viewing a single comment's thread. Return to all comments →
JS Solution
let matchMap = {} let pairs = 0 ar.forEach(num => { if (matchMap[num] === undefined) { matchMap[num] = 0 } matchMap[num] += 1 }) for (const num in matchMap) { if (matchMap[num] > 1) { pairs += (Math.floor(matchMap[num] / 2)) } } return pairs
Sales by Match
You are viewing a single comment's thread. Return to all comments →
JS Solution