Modular exponentiation problem

sir why are we taking mod at each step . if am taking mod at last its not passing all test cases.

@gulatigarvita08 taking at last step only dont do any good what if no exceeded the range in somewhere between . always remember if we have to take mod in question we have to take it at every step.
i hope your doubt is cleared if yes dont forget to mark it as resolved :smiley:

1 Like