filmov
tv
HackerRank The Sock Merchant Challenge using JavaScript

Показать описание
Using ES6 high array methods like reduce(), filter(), some() i went about this challenge.
If you guys have another way to go about this challenge feel free to put it on the comments section.
Question:-
John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.
It must return an integer representing the number of matching pairs of socks that are available.
If you guys have another way to go about this challenge feel free to put it on the comments section.
Question:-
John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.
It must return an integer representing the number of matching pairs of socks that are available.