Please read the new rule regarding the restriction on the use of AI tools. ×

Uber coding round problem

Revision en2, by migy8d3u1epe39, 2021-11-07 08:48:47

The problem was in a long story format but let me simplify it for you :-)

Problem: Some genie has power P. He wants to grant n wishes of the form {xi, yi}. Now to grant i-th wish he needs to have at least power xi and after granting this wish his power becomes P-yi. In this process, his power shouldn't dip below zero. What are the maximum possible wishes he can grant?

Constraints: 1<=n<=100, 1<=P<=30000, 1<=x<=30000, -300<=y<=300

I couldn't solve this problem in test time, I've seen so many problems of this type but I always fail. I would be grateful if someone explains this. Thanks have a good day!

Tags help, #uber

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English migy8d3u1epe39 2021-11-07 09:02:53 28
en2 English migy8d3u1epe39 2021-11-07 08:48:47 2 Tiny change: '<=100, 1<=p<=30000, 1' -> '<=100, 1<=P<=30000, 1'
en1 English migy8d3u1epe39 2021-11-07 08:46:18 640 Initial revision (published)