Categorygithub.com/ductnn/coding-practicealgoexpertCoding-Interview-QuestionsArraysGreennon-constructible-change
package
0.0.0-20241225161807-6c2a4c2dbe8f
Repository: https://github.com/ductnn/coding-practice.git
Documentation: pkg.go.dev
# README
Non-Constructible Change
Problem
-
Difficulty: Green, Category: Arrays
Given an array of positive integers representing the values of coins in your possession, write a function that returns the minimum amount of change (the minimum sum of money) that you cannot create. The given coins can have any positive integer value and aren't necessarily unique (i.e., you can have multiple coins of the same value).
For example, if you're given
coins = [1, 2, 5]
, the minimum amount of change that you can't create is4
. If you're given no coins, the minimum amount of change that you can't create is1
.Sample Input
coins = [5, 7, 1, 1, 2, 3, 22]
Sample Output
20