#3137

Minimum Number of Operations to Make Word K-Periodic

specialist · 715 · lc medium +30 · 60.7% accepted · 123 likes · top 60%

Description

Given a string word of length n and divisor k, each operation replaces the length-k chunk starting at a k-multiple index with any other such chunk. Return the minimum operations to make word k-periodic (consisting of a single repeated length-k pattern).

Code

1
2
3