Find minimum number of coins that make a given value: Difference between revisions

Content added Content deleted
(Add APL)
Line 17: Line 17:
one coin of 1
one coin of 1
<br><br>
<br><br>

=={{header|APL}}==
{{works with|Dyalog APL}}
<lang APL>coins←{
{⍺,≢⍵}⌸⍺[⍒⍺]{
coin←⊃(⍵≥⍺)/⍺
coin=0:⍬
coin,⍺∇⍵-coin
}⍵
}</lang>
{{out}}
<pre> (1 2 5 10 20 50 100 200) coins 988
200 4
100 1
50 1
20 1
10 1
5 1
2 1
1 1</pre>


=={{header|AppleScript}}==
=={{header|AppleScript}}==