Kth root problem

unable to understand problem

Hello @bhattanurag426 in this question you have to find out the value of x such that when you take the power k to it should be equal to n or less then n but the answer of x should be like that it should be nearest to n.
if you have any further doubt you can ask here:
Happy Learning!!

https://ide.codingblocks.com/s/401086 time limit excees

time limit exceed

Hello @bhattanurag426 this is because your approach is not optimised.
you are iterating through the range and then also you are using pow STL so thats why you code is not optimised.
i am telling you the optimised approach:
we have to finf the largest value of the result such that x^k<=n
then think this way:
x<=n^(1/k) and this you can simply do by using pow function in this:
Here for your reference i am attaching the 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.