This guide walks through how to build out the common Ruby coding interview question: how to build out an ATM dispensing method.

## Summary

Implement an ATM method that properly dispenses the correct denominations to a user.

Code File

## Exercise Description

Build out a method that takes two arguments: the total amount of money requested and the denominations that can be returned. And return the count of how many bills of each denomination should be returned to a user.

## Example Data Input

```245, [20, 10, 5]
```

In this example, `245` is the total amount requested at the ATM, and the array represents `20`, `10`, and `5` dollar bills.

## Expected Output

```{20=>12, 10=>0, 5=>1}
```

This hash represents `12` \$20 dollar bills and `1` \$5 dollar bills.

## Real World Usage

This exercise is a very popular Ruby coding interview question. This will test your knowledge of several mathematical methods along with how you can combine multiple functional programming concepts.

## Solution

Can be found on the solutions branch on github.

#### 1 COMMENT

1. Divya

One question I have is, can we just say

hash[denomination] = total.divmod(denomination).first

return raw_data , so that we can probably avoid this portion.

raw_data.map do |k, v|
raw_data[k] = v.first
end