Please use Laptop/Desktop or any other large screen for the Mock Interview Session.

Coin Change - Find Possibilities and Count Possibilities.



YouTube Video Thumbnail
Link

Watch above sample mock interview video to see how it works.
Login and Buy Premium to Start the Interview



Minimal Coins Problem

Minimal Coins Problem

Problem Statement

Given a list of coin values and a target sum, write a function to determine the minimum quantity of coins needed to reach the exact target sum. If it is impossible to reach that sum with the given coins, return -1.

Examples

Example 1:

Coins: [1, 3, 4], Target: 6
   Result: 2
   Explanation: 6 = 3 + 3

Example 2:

Coins:[2, 7], Target: 5
   Result: -1

Constraints

  • 1 ≤ number of coins ≤ 25
  • 1 ≤ coin value ≤ 100
  • 0 ≤ target sum ≤ 10,000