Maximum value of products the person can buy D-bay, an online clothes and fashion store, is giving a 20% cashback on purchases worth €1000 or above made on its website.  (i.e. when you purchase something worth, say, €3000, your account will be credited back with an amount of €600).  If Alex has €10,000 with him, what is the maximum value of the products which he can purchase from the website ?
My approach:-
First spending = €10000,
Cashback received = €2000
Second spending = €2000,
Cashback received = €400
Third spending = €400,
Now no cashback would be received as spending is < €1000
which gives me a total of €10000+€2000+€400=€12400
but the answer is given as €12450
 A: Your approach looks fine. However, give a closer look for Third Spending since, the amount is less than €$1000$ you are not getting any cashback. In an ideal scenario you want non-cashback eligible amount (which is €400 in your example) to be as small as possible. Consider the following example: You have €1000 in hand, instead of spending it in one go you spend €500 two times. Is the total spending same? No, when you spend €1000 in one go, total spending is €1000 + €200, in the second case its just €500+500=€1000. This is because you did not receive any cashback on both of the €500. Hence, the < €1000 transaction should be minimum.
Let's try to optimize that, How about we spend €$x$ in second spending? We want the amount for third transaction to be €1000 so that our non-cashback eligible amount becomes €200 which is the minimum possible. This translates to:
$$
\left(\frac{20}{100}\times x \right)+2000-x = 1000
$$
where $\left(\frac{20}{100}\times x \right)$ is the cashback received from second transaction and $2000-x$ is the balance amount. You equate it to $€1000$ so that the next immediate transaction is of €1000 and the final terminal transaction (<€1000 and hence, non-cashback eligible) is of €200 which is our goal.
Hence, $x=€1250$. Your transactions look like:
First spending = €10000, Cashback received = €2000
Second spending = €1250, Cashback received = €250, Balance = €2000 - €1250 = €750
Third spending = €250 + €750 = €1000, Cashback received = €200
Fourth spending = €200, Now no Cashback would be received as spending is < €1000
Total Spending = €(10000+1250+1000+200) = €12450
We cannot do better than this because the minimum cashback possible is 20% of €1000 = €200 and our final spending = €200. Hence we are not losing out on any cashback possible.
