Stack Bash - Master data structures and algorithms

Coin change

Medium
Given an array of coin denominations and a total, find the minimum number of coins that it would take to make up the total.
For example, given the inputs
coins = [1, 2, 5]
total = 9
Your function should return 3 since you only need two 2 coins and one 5 coin to make the total 9.
(2 * 2) + (1 * 5) = 9

Solution

8 Essential Recursion & Dynamic Programming Coding Interview Problems

Master Recursion & Dynamic Programming by trying the coding challenges below.
  1. 1.FibonacciEasy
  2. 2.Unique pathsMedium
  3. 3.KnapsackMedium
  4. 4.Subset sumMedium
  5. 5.Power setMedium
  6. 6.Coin changeMedium
  7. 7.Word breakHard
  8. 8.Longest common subsequenceHard

Want to confidently pass your next coding interview?

Stack Bash helps new and veteran software engineers master data structures and algorithms for technical interviews.