Practice Minimum Number of Coins to be Added
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed integer array coins, representing the values of the coins available, and an integer target. An integer x is obtainable if there exists a subsequence of coins that sums to x. 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.
Source: Minimum Number of Coins to be Added on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
coins = [1,4,10], target = 19
2
# Example 2
coins = [1,4,10,5,7,19], target = 19
1
# Example 3
coins = [1,1,1], target = 20
3
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Number of Coins to be Added.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.