Modular exponentiation


why my code does not passing test cases
i have used pow func also that was not doing as well

You were not taking mod at each step. the sole purpose of modular exponentiation is to calculate big powers (numbers which are >10^18 ). which you cannot store in long long int.


@shampblocks