Basket Totals Under Price Updates and Budget Queries

Asked at DRW · Coding Questions · Difficulty: Medium · Last asked Nov 23, 2026

A desk tracks a set of products, each with an integer price, and a list of baskets, each a list of products. The price of a basket is the sum of the prices of the products it lists. Prices change one product at a time. Between changes, the desk wants to know how many baskets it could buy within a given budget. Build a class that answers those budget questions while the prices keep moving.

Loading the problem…