Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Contest 3-B: Chant Rhythm

โญ beginnerโณ 40 min read๐Ÿ“ Lesson 198 of 281

Mock contest 3, problem B: shortest period via the KMP failure function. Target: solved within 40 minutes.

Contest 3-B โ€” Chant Rhythm. Shortest period = n - fail[n]. The period does NOT have to divide n. Graded near-miss: divisor-only checking.

Contest 3-B. The wrong version scans divisors of n and falls back to n โ€” "abcabca" (period 3, n 7) and the 1000001-char load both break it.