Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If you can make the first x values and you have a value v, then you can make all the values <var>≤ v + x</var>
Sort the array of coins. You can always make the value 0 so you can start with x = 0.
Process the values starting from the smallest and stop when there is a value that cannot be achieved with the current x.