Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3405. Count the Number of Arrays with K Matching Adjacent Elements
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.