Monday, May 13, 2013

Elixir - Coin changer kata

At the end of week two, Eric told me to write the coin changer kata in Elixir to get myself familiar with the language.

Problem: 
Given an amount of money, write a program to return the least coin possible. For example:
Input: 47 (cents)
Output: 25, 10, 10, 1, 1 (which means 1 quarter, 2 dimes, and 2 pennies)

I did the coin changing kata with Kelly before in Ruby. It wasn't that hard. But Elixir has a different school of thoughts. I have to write the program without using if or regular looping. Instead, I have to use  guard statement and recursion for looping. Here's a video on what I did. 

I can't attached the files at this time. So here's the link:
http://www.youtube.com/watch?v=miN8XTE0XY0
Resource:

0 comments:

Post a Comment