corrected small coin change error

master
Evan Hemsley 2015-12-18 19:57:08 -08:00
parent e364cffdbf
commit f7af5044bd
1 changed files with 3 additions and 3 deletions

View File

@ -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