How can I modulo when my numbers start from 1, not zero?
Just subtract 1 and add 1 afterwards. In most programming languages, you need to watch out when finding a “previous” value, because for negative numbers, modulo does not work as you want in this case: it returns a negative number. Here’s the C/C++ version: int next(int i, int m, int n) { return (i + … Read more