KTH Root - Different Approach

Instead of binary search can we use this approach?


Is it the efficient approach to use newton’s method?

@koshimagoyal97
I think you are talking about this problem.
https://hack.codingblocks.com/contests/c/720/274
In this problem, we have to find such a max value of i which satisfies Math.pow(x,i)<=n.
what you tried to think is you made above eqn as x<=Kth root of N.
Yes,Newtons Method will be much efficient in finding the Kth root and infact it will give the precise value as it using double. Just find max k till x<=kth root N satisfies.

I have already solved this question using binary search but I find this approach so I was just eager to know about this approach.
Thanks

@koshimagoyal97

Further if you don’t have any doubt in this problem,please mark it as resolved else you can anytime come back to this post and ask your doubt.