i am getting ans as -1 for n>=10^8 … i know its because the value in VAL is getting too large…but how to rectify it?
Problem in code
@tusharbhardwaj127 See when you take a number let’s say 10^12 and multiple it10^4 times it would be a huge huge value . Which wouldn’t fit in long long int datatype. So try a brute Force method. Instead along with binary search. I hope the hint which I have u would help
i tried it, but i’m still facing the same issue. please check https://ide.codingblocks.com/s/234826
Take base cases like k=1 return n and k=2 return sqrt (n)