An open API service indexing awesome lists of open source software.

https://github.com/holsee/matchsticks

matchsticks kata
https://github.com/holsee/matchsticks

elixir kata

Last synced: about 1 year ago
JSON representation

matchsticks kata

Awesome Lists containing this project

README

          

# Matchsticks Kata

Write a function that will calculate the number of boxes necessary to accommodate some matchsticks.

* It returns a map with the number of boxes necessary for each type of box.
* The factory has three types of boxes: the big ones hold fifty matchsticks, the medium ones hold twenty, and the small ones hold five.
* The boxes can't have fewer matchstick that they can hold; they must be full.
* The returning map should contain the remaining matchsticks.

It should work like this:

``` elixir
iex> Matchsticks.boxes(98)
%{big: 1, medium: 2, remaining_matchsticks: 3, small: 1}

iex> Matchsticks.boxes(39)
%{big: 0, medium: 1, remaining_matchsticks: 4, small: 3}
```

## Elixir Solution

Compile and Run Tests
```
mix do deps.get, compile
mix test
```