Kth root binary search algo not working

Here is the link to my code, I tried implementing binary search, but it doesn’t work, please help me

Hello @Lakshita2002 what is the question that you are trying to do?
you have run the for loop in the while loop that will give every time different answer to x so it woudnt be bale to compare.
i think you have applied your logic in the wrong way.
please share the question which you want to do.
Happy Learning!!

hello @tusharaggarwal272
here is the link to the question
https://hack.codingblocks.com/app/practice/1/43/problem
Actually, I thought using a loop will increase the computation time, thats why used binary search approach

Hello @Lakshita2002 see its very good of you you tried to do that in some different way.
but here i am giving you very simple appraoch.


if you have any doubt you can ask here:
Happy Learning!!

@tusharaggarwal272
ok, now I see, this is way simpler this way. I understand now
Thank you

@Lakshita2002 if you feel that your doubt is cleared you can makr this doubt as resolved.
Happy Learning !!

1 Like

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.