Greedy Coins
CodeChefOpen on judge ↗
Alice must pay exactly $n$ rupees at the checkout at hotel. He has coins of two values: $1$ rupess and $2$ rupees. Alice likes both kinds of coins equally, so he doesn't want to pay with more coins of one type than with the other. So alice wants to minimize the difference between the count of coins of $1$ rupees and $2$ rupees being used. You are friend of alice so you help him by det
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.
Sign in to chat with the tutor and save your progress.
Sign in to start