9/5/2019 1:48:06 PM
A neat mathematical trick:
-n % k = k - (n % k).
Meaning, to find (−n)%k, just find k−(n%k).
In python sign of result of mod is sign of denominator
see this link and follow the links mentioned in link
Send us a message