Cannot figure out the 3 test case


Working with 2 test cases only

Hey @abhinavsehgal802_270a44594b6dc4ad,
You need to solve the above problem using binary search.
Your code fails for this testcase : 1000000000000 6
as the precision of double isn’t as expected in Java and needs to be set manually, so the answer isn’t accurate.
So rather than solving the problem using double. It’s advisable to use long to avoid any decimal conversions.
Hope it helps :slight_smile:

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.