I’m unable to figure out the solution of “Kth Root” challenge from ‘Sorting and searching’. Kindly provide me the solution or hint of this problem.
Unable to solve Kth Root problem
@anantinsan
The problem is extremely similar to the square root problem which has been discussed in the videos of Sorting and Searching section. In the square root problem , we checked whether midmid == n or midmid < n as we were concerned with finding the square root of n. Here , we wish to compute the kth root of n so make the comparisons as
pow(mid, k) == n and pow(mid, k) < n.
Most of the remaining code remains same without much alterations. Try this out and let me know if you need any further help.
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.
Yes, cleared, thanks