Kth Root Timelimit Problem

Please Suggest Optimizations as I’m getting timelimit in 2nd Test case .
code link https://ide.codingblocks.com/s/102501

Hi Abhinav basically what your code is doing is it is traversing i=1 to N till Math.pow(i,k) doesnt becomes greater than n .
So the current Time Complexity is tc*[N raised to power k]. which is quite huge.

Morover,we can apply binary search in this problem. For every possible mid obtained by using binary search we will check of it is the best suitable candidate or not for becoming the Kth root and then we reduce the search space of the binary search according to the mid value.
please do mark the doubt as resolved if you dont have further queries.

Okay let me try this using binary selection.

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.