Finding Kth root

https://ide.codingblocks.com/s/241265 This is my code it is showing TLE.
In the example there are inputs 10000000000000 , 10 and the output is 32 shouldn’t this be opposite

There are multiple errors in your code. Forest of all take long long int every where. Second thing when you multiply 10^15 even twice it would cross the limit. So multiply by brute Force and check after every multiplication. Also take l=0, r=10^8.

You can have a look at this https://ide.codingblocks.com/s/199511 for reference.

https://ide.codingblocks.com/s/242458 this is the new code and in input 1 27 3 it is giving 2 i dont understand why

This is a wrong code. First of all you have used pow function . Which would not give you correct answer as it has a fixed range of 10^18. So multiplying it manually different number of times would help.

the code you gave me used pow function

and range won’t be an issue for inputs 1 -27-3 kindly see to it

@Gautampriyadarshi Sent a wrong one kindly check this. https://ide.codingblocks.com/s/243017 This is the one I was talking about

Range is an issue suppose you want to binary search on l=0, r=4000. Your mid value will be 2000 and lets say you take 3^2000 which will not fit in a long long datatype so you have to multiply it 2000 times instead of taking a pow function. And giveit a try

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.