Cartridge Recycle Problem
Given : Four input parameters: Cartridges, Dollars, recycleReward, perksCost.
One has two options:
- Recycle one cartridge and get recycleReward amount of dollars
- Combine one cartridge and perksCost amount to get a perk item.
Need to maximise the perk items one can buy.
Eg: 10, 10, 2, 2
Initially there are 10 cartridges, 10 dollars with the person. If the person recycles 3 cartridges he has 7 cartridges and 16 dollars (10 initial + 3*2(recycleReward)).
Combining 7 cartridges and 14 dollars to buy 7 perk items(as each item costs 1 cartridge and 2 dollars(perksCost)), max perks that can be bought is 7.
Possible Solution's Flow Diagram: https://drive.google.com/file/d/1hQxT-MQuCAweZLOJCOO_J08a48txNEve/view