Sha256: 0c061e764856f52ac99981596506e055b3b00171647b9770a8116e1b47f128a9
Contents?: true
Size: 579 Bytes
Versions: 131
Compression:
Stored size: 579 Bytes
Contents
defmodule Change do @doc """ Determine the least number of coins to be given to the user such that the sum of the coins' value would equal the correct amount of change. It returns :error if it is not possible to compute the right amount of coins. Otherwise returns the tuple {:ok, map_of_coins} ## Examples iex> Change.generate(3, [5, 10, 15]) :error iex> Change.generate(18, [1, 5, 10]) {:ok, %{1 => 3, 5 => 1, 10 => 1}} """ @spec generate(integer, list) :: {:ok, map} | :error def generate(amount, values) do end end
Version data entries
131 entries across 131 versions & 1 rubygems