Sales by Match Problem Description There is a large pile of socks that must be paired by color. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are. Example There is one pa...

Markdown supported · ⌘↵ to post
Biplob Manna
I do interesting things when I get bored!
Nice article!
If I could provide some suggestion here, in the second for loop, all those lines of
ifconditions andisEven()function call can be reduced topairs += counts[item] / 2 | 0to get the integer division value.for (const item in counts) pairs += counts[item] / 2 | 0;