Can anybody tell me where I have made mistake?

p.s. How can I use priority queue in it?

Can anybody tell me where I have made mistake?

p.s. How can I use priority queue in it?

Thank you for your reply. I saw your binary search approach. My approach also looks same. You generated the amount of prata using a formula. I used an iterative approach. But it gives the same thing. Where have I made mistake?

What is the formula used inside the check() method to calculate the pratas ?

1 Like