Available question text
Count the number of length-n arrays with values in [1..m] that have exactly k adjacent equal pairs (equivalently exactly n-1-k transitions), returning the result mod 1e9+7. The core challenge is a combinatorics/DP counting problem: efficiently count arrangements of transition positions and value assignments under constraints up to 1e5.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3405. Count the Number of Arrays with K Matching Adjacent Elements
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source