KTH ROOT problem sorting and searching

You are given two integers n and k. Find the greatest integer x, such that, x^k <= n.
please check my code and tell me whats the error(in comments) and please correct it

Hello @dhruvk3k the code which you have shared in that the for loop along with while loop and with that using pow function as well is making time complexity of it big.
if you want to use power function you can then see this code:


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

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.