DEV Community

Discussion on: Javascript Sock Merchant Challenge - Solution 1

Collapse
 
kurisutofu profile image
kurisutofu

I had the same idea as Bhavesh but looking at the code in the article (I could not watch the video so sorry if it's in there), I'm a little confused.

Is arr populated with only the color integer? Like [1,2,1,1,3] for example?

Also, if you have something like [1,1,1], does the function need to return 1 or 2?

1 pair and 1 lonely sock?
Or 2 possible pairs?

Collapse
 
adyngom profile image
Ady Ngom

Yes array is only populated with color integer and the challenge is specific about actual pairs so no possible. [1,1,1] should return 1 to satisfy the exercise requirements