Modular exponentiation

sir i wrote this code but it is only passing 3 test cases out of 10 and i got 30/100. i am unable to understand that what am i doing wrong. please somebody look into my code and help me. the link of my code is -

hello @pushkar24sharma
apply modular exponentiation technique to compute the required answer
otherwise due to overflow u will get wrong answer

1 Like

@aman212yadav sir i tried this new code in which i used exponentiation using bitmasking. now the result is better than previous case. but still it is not getting accepted.
this is my modified code

sir what is modular exponentiation technique. i dont know about this technique.
please help me

image

use mod here as well.

image

modular exponentiation

1 Like

@aman212yadav sir now it is not passing only 1 test case. everything is alright. please look into the code once more.

i did it using modular exponentiation technique as said by u.

:pray:

checck ur power optimised function

1 Like

@aman212yadav sir still i didnt get what am i doing wrong? this is passing 9/10 test cases but only 1 test case is not passed. can u please make the changes in this code which i am sending bcoz it would be more clear and helpful.

ok thank u @aman212yadav sir finally it is working