Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions katas/pair-of-gloves/pair-of-gloves.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function numberOfPairs(gloves) {
//My hands are freezing
}
7 changes: 7 additions & 0 deletions katas/pair-of-gloves/pair-of-gloves_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('pair of gloves', function() {
it('should return number of pairs of gloves', function() {
expect(numberOfPairs(['red', 'red'])).toEqual(1);
expect(numberOfPairs(['red', 'green', 'blue'])).toEqual(0);
expect(numberOfPairs(['gray','black','purple','purple','gray','black'])).toEqual(3);
});
});
25 changes: 25 additions & 0 deletions katas/pair-of-gloves/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
####Description:

Winter is comming, you must prepare your ski holidays. The objective of this kata is to determine the number of pair of gloves you can constitute from the gloves you have in your drawer.

A pair of gloves is constituted of two gloves of the same color.

You are given an array containing the color of each glove.

You must return the number of pair you can constitute.

You must not change the input array.

####Example:

```js
numberOfPairs(['red', 'red']) //returns 2
numberOfPairs(['red', 'green', 'blue']) //returns 0
numberOfPairs(['gray','black','purple','purple','gray','black']) //returns 3
```

See [tests in pair-of-gloves_test.js](https://github.com/AlexVvx/code-wars/blob/master/katas/pair-of-gloves/pair-of-gloves_test.js)

#####[Original Kata](https://www.codewars.com/kata/pair-of-gloves)

Good luck