Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 945 Bytes

README.md

File metadata and controls

20 lines (14 loc) · 945 Bytes

Coding challange DSC MOI

This example project is written in Node, and tested with Jest.

Setup command

npm install

Run command

npm test

The assignment

John’s clothing store has a pile of loose socks where each sock i has a value denoting its color socks[i]. He wants to sell as many socks as possible, but his customers will only buy them in matching pairs. Two socks are a single matching pairs if their value are equal: socks[i] === socks[j] . Given an array socks which will hold all the socks value, how many pairs of socks can John sell?.

Input Format

We’re given an array socks where each item in the array socks[i] contains a value representing the sock color.

Sample input

An array of color values representing each sock’s color: socks = [10, 20, 20, 10, 10, 30, 50, 10, 20];

The tests are failing right now because we're not returning the correct string. Fixing this up will make the tests green.