← All problemsSign in

Special Discounts

A Shopkeeper sells $N$ items. Each item costs same number of cents - $X$ cents and there are two types of discounts associated with each item $A[i]$ and $B[i]$ cents. Yash goes to the shop with $Y$ cents in his pocket. He can buy any number of items. Suppose he buys $K$ items with indices $i$$1$ $,$ $i$$2$ $.....$ $i$$K$. Total discount on a set of items is equal to $min$ ($\sum_{j=1}^K$ $A$$i$$j$

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start