Back to problems

Minimum Purchases to Fill an Exact Target Amount

Algorithm · Airbnb · Medium

Problem You are given a target amount target and a list of n item prices prices. You may buy each item as many times as you want. Your task is to determine: Whether it is possible to select a collection of items whose total price equals target exactly. If it is possible, the smallest number of items needed to reach that exact total. One specific purchase combination that uses that minimum number of items. If the target cannot be formed exactly, indicate failure. All values…

Checking your access…