For the given test case

1

2 4

7 14

The problem is accepting 3 as the answer whereas the answer should be 4.

**Explanation**

If you give 4 cures on day 1, next day you can give only 6 cures because the population becomes (7-4)*2=6. So in day 2 you can give 6 cures. On day 3, you can give 12 cures which is less than 14 so a total 4 days is required. In no way you can give all 7 cures in second day.

No you are wrong. Consider this way -

Give the 4 cures to the second country. The infected people in that country becomes 10 which again reaches 14 at the end of the day.

The next day you have 8 cures. Give 7 of them to the first. That country is cured.

The third day, you will have 14 cures. Give them to the second and with this all countries are cured.

The answer is therefore 3 only.

1 Like

Thanks I got it