why last two test cases fail.
Power(o(longn)) question
There is no mention to print your answer using mod. Please donot use untill and unless it is mentioned in the question.
it doesn’t matter both give same result.
No brother it does not, lets say you take 2^40, so that exceeds 10^9 + 7, so it will do a mod, but you do not need to.
i’m getting you.
what actually i mean is
with or without mod my two test case fail.
i think you got my point.
help me to fix this.
Your code fails for 2 and 4. In case you need a help for the code, please say.
if(y & 1) ans = ans * x;
x = x*x;
pw(x , y / 2, ans);
This will be the recursive call.
it fail for 3 && 4 test cases.
it work thank you for helping.
can you figure out what’s wrong with my code.
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.