Back to problems

Minimum Pins to Exactly Fill a Screen

Algorithm · Pinterest · Medium

Minimum Weights for Exact Total Medium · Topics · Company Tags · Hints You have a collection of weights, each with a positive integer mass. You want to place some of them on a scale so that the total mass equals a target value target. Every weight may be used at most once. Your task is to find the smallest number of weights that together sum exactly to target. If it is impossible to reach target with any subset, return -1. Example 1: Explanation: The subset {2, 8} sums to 10…

Checking your access…