My code gives Right Answers in my local IDE, but Wrong Answer in the Coding Blocks platform.
Code giving AC in IDE, but WA in CB platform
a) use long long in place of int.
b)
use following property for this line->
(a-b)%mod= (a-b+mod)%mod;
c)
use mod here as well .
(ab)%mod=(a%modb%mod)%mod
@aman212yadav Sir, in JAVA there is no long long.
And sir, is (a-b)%mod = (a%mod - b%mod)%mod or (a-b)%mod= (a-b+mod)%mod ?
both are true but to avoid negative mod for this problem , we will use the later one.
I guess long is there , so use that
Sorry sir, I didn’t paste the latest code. In the latest code I used long for the DP array but same results were there.
share ur latest code ,i will check
Yes sir, by using long and mod expressions all test cases passed.
Thanks a lot for the help sir.