What would be the monotonoic search space in this problem for the values of x. How do I make it ?
Doubt in implementation
You need x^k == n. So search on value of x from 1 to n.
if x^k < n then u need to look in right interval i.e element greater than x
if x^k > n then u need to look in left interval i.e elements lesser than x.
same as our binaray search works
1 Like
Ok I understand now I can do it. Thanks for resolving my doubt
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.