It is giving TLE

My code is giving TLE

@anuragsingh04548 try using the pow function its more optimized

Still getting this : runguard: warning: timelimit exceeded (wall time): aborting command runguard: warning: command terminated with signal 15

this is my new code its not giving TLE now but it is giving wrong answer for the given sample test cases

@anuragsingh04548 pow(mid, k) will result in integer overflow in some of the cases, and the answer will become negative so the binary search method will fail. To avoid this problem, dont store pow(mid, k) in any variable, use it for comparison directly.

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.