What is the purpose of "value % MOD" with a weird MOD number?


#1

What is the purpose of “value % MOD” with a weird MOD number?


#2

To avoid overflow while still being able to differentiate a solution.


#3

The significance of choosing such a number is very important. first of all it helps solution to not overflow. Second of all it is a prime number . The prime number density decreases when you increase the number so you will get to see this number a lot and also 1000000007. Happy learning :slightly_smiling_face: