https://github.com/holsee/matchsticks
matchsticks kata
https://github.com/holsee/matchsticks
elixir kata
Last synced: about 1 year ago
JSON representation
matchsticks kata
- Host: GitHub
- URL: https://github.com/holsee/matchsticks
- Owner: holsee
- Created: 2018-06-25T11:34:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-28T10:06:34.000Z (almost 8 years ago)
- Last Synced: 2025-02-05T06:44:39.232Z (over 1 year ago)
- Topics: elixir, kata
- Language: Elixir
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```