Given value of n, how can we find the power(p) of 2 such that the result 2^p starts with n.
For ex —
n = 12 then answer is 7 i.e., 2^7 = 128.
n = 82 then answer is 209 i.e., 2^209 = 822752278660603021.........
If no such power exist then p should be -1.
I have coded it, but giving WA and TLE on some test cases. Here is the link to my code : link
How can we find power efficiently ? I got this problem on link
UPD : Thank you all, Tima's approach helps me to get AC. In case anyone interested, here is the link to my code : link