Problem 3405 · Hard

Count the Number of Arrays with K Matching Adjacent Elements

Choose which k neighbouring pairs match with a binomial coefficient, then multiply the m-1 choices for each pair that must differ.

Open the interactive visualisation