- i am using search space as 0-n .is it the correct search space or there is some more optimum search space available.
- is is the correct approach and where is the problem in my code.
CODE ID:271567
Compilation error
hello @chitranshanmol07
your code is correct.
but becuase value of n is very large 10^15.
we cannot compute exponent using pow function as overflow wil occur.
so to avoid it we will do two things.
a)
we will shrink our range of search
b)
we will use for loop to compute mid^k and if at any iteration value of mid^k get bigger than n.
we will break and perform required updation
refer this ->