2 test cases not passing
ques-https://hack.codingblocks.com/app/contests/473/p/92 sol - https://ide.codingblocks.com/s/187428
2 test cases not passing
In order to calculate a^b mod m, you are calculating (a mod m)^ (b mod m) )mod m which is different from a^b mod m.
Using fermat’s theorem, a^(m-1) mod m =1,when m is prime.In our case,m =1000000007 is a prime no.,therefore a^b mod m = a^(m-1) mod m * a^(m-1) mod m …* a^(x) mod m , and a^(m-1)mod m being equal to 1,we are left with a^x mod m,and x will be b mod (m-1).
So,you a^b mod m = (a mod m)^( b mod m-1)
You can see the corrected code for reference.
Thanks i got the mistake
is yr doubt resolved?
mam are u the Ta for the carrer bootcamp
yes , i am ta for this
what is your number?