Maths Day-Competitve Programming

Why getting wrong answer for few test cases ?

Taking mod at each and every small step is required in power function. Please have a look. Just the use of mod here in power function.

I made the changes you said but still getting 2 test cases wrong and i don’t know where the problem is coming

I have fixed the code. Please check.

What help will it do to run the loop in reverse order bcz i tried it and no luck.

It will help overflow.
Sometimes, it may happen that you overflow even while using mod. So its’ better to do powers in reverse order. Thats my observation.

Thats okay but i am facing the same problem that is why am i getting 2 wrong answers.
I have also tried by your way

I have run your code and its getting 100.

Well now it worked somehow :sweat_smile:. Thanks for your help

Great!
Hit like if you got it :grinning: