Alice's Verbal Kho-Kho — Digit Passing Game
M · mediumP · Verified PYQ
Problem
Alice gives a digit to F[1]. Each friend passes the digit to the next without speaking. A confused friend passes digit+1 (wraps: 9->0). Others pass correctly. Given starting digit S, N friends, and final digit F, find how many confusions occurred.
Example
Input
3 5 7
Output
2
confusions = (final - start + 10) % 10. This works due to modular arithmetic.
Start=5, 3 friends, final=7. Confusions = (7-5+10)%10 = 2.