can u please tell the logic for this question and what question is saying
Cant understand the question
Hi @vmayaan,
According to the question,
- Initially there are N students and M coupons
- 100% wavier is given to those who have at least X coupons (good students)
- Bad students must give Y coupons to take admission
So, let’s form an equation, If there are k good students then (N - k) students must have performed bad.
Initial Coupons - k*X + (N - k)*Y >= 0
Initial Coupons = M
You, just need to solve this equation by maximizing k such that k <= N
Hint: You can apply binary search for optimal k
@vmayaan, for implementation difficulty refer https://ide.codingblocks.com/s/646970?_ga=2.194742253.1349480821.1650699623-564174853.1650699623
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.