corrected small coin change error
parent
e364cffdbf
commit
f7af5044bd
|
@ -3,10 +3,10 @@ def change(n, list_of_coins)
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_helper(n, list_of_coins, result_list)
|
def change_helper(n, list_of_coins, result_list)
|
||||||
if list_of_coins.empty?
|
if n == 0
|
||||||
return []
|
|
||||||
elsif n == 0
|
|
||||||
return [result_list]
|
return [result_list]
|
||||||
|
elsif list_of_coins.empty?
|
||||||
|
return []
|
||||||
else
|
else
|
||||||
list_of_coins.each do |coin|
|
list_of_coins.each do |coin|
|
||||||
if n < coin
|
if n < coin
|
||||||
|
|
Loading…
Reference in New Issue