2952. Minimum Number of Coins to be Added
You are given a 0-indexed integer array
coins
, representing the values of the coins available, and an integertarget
.An integer
x
is obtainable if there exists a subsequence ofcoins
that sums tox
.Return the minimum number of coins of any value that need to be added to the array so that every integer in the range
[1, target]
is obtainable.A subsequence of an array is a new non-empty array that is formed from the original array by deleting some (possibly none) of the elements without disturbing the relative positions of the remaining elements.
1 | class Solution { |