This is a verified interview question from Hummingbird. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Shopping Offers - HummingBird" covers key patterns like DP.
"There are n different items available in the LeetCode Store, and each item has an individual price. Besides purchasing items individually, there are several special offers. Each special offer contains a combination of one or more different items at a discounted price. You are given: - An integer array price, where price[i] represents the price of the ith item. - An integer array needs, where needs[i] represents the number of units of the ith item you want to buy. - A 2D integer array special, where each special[i] has a size of n + 1: - special[i][j] represents the number of units of the jth item included in the ith offer. - special[i][n] (the last element) represents the total price of that offer. Your task is to find the minimum cost required to purchase exactly the items specified in needs. Rules: - You may use any special offer any number of times. - You cannot buy more items than required, even if doing so would reduce the overall cost. Return the minimum amount of money needed to satisfy all the requirements."
Join thousands of developers practicing for Hummingbird.