Fix syntax issues

This commit is contained in:
Vitor Oliveira 2021-03-09 19:03:25 -08:00
parent 1553e26a91
commit 8363ae81fd
3 changed files with 28 additions and 29 deletions

View file

@ -26,5 +26,6 @@ def coin_change_minimum(coins, amount)
coins = Array[2, 4, 5] coins = Array[2, 4, 5]
amount = 12 amount = 12
puts "Number of combinations of getting change for " + amount.to_s + " is "+ coin_change_combinations(coins, amount).to_s + "." puts 'Number of combinations of getting change for ' + amount.to_s + ' is ' + coin_change_combinations(coins,
puts "Minimum number of coins required for " + amount.to_s + " is "+ coin_change_minimum(coins, amount).to_s + "." amount).to_s + '.'
puts 'Minimum number of coins required for ' + amount.to_s + ' is ' + coin_change_minimum(coins, amount).to_s + '.'

View file

@ -34,9 +34,7 @@ def decimal_to_binary(d)
return binary if d == 0 return binary if d == 0
return 1.to_s if d == 1 return 1.to_s if d == 1
binary = decimal_to_binary(d / 2).to_s + binary decimal_to_binary(d / 2).to_s + binary
binary
end end
puts 'Binary value of 4 is ' + decimal_to_binary(4).to_s puts 'Binary value of 4 is ' + decimal_to_binary(4).to_s