Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3426. Manhattan Distances of All Arrangements of Pieces
Compute the total sum of pairwise Manhattan distances over all ways to place k identical pieces on an m×n grid (one per cell), modulo 1e9+7. The core challenge is combinatorial counting: for each pair of cells count how many arrangements include that pair (choose the other k−2 cells) and exploit that Manhattan distance separates into independent row and column contributions to aggregate efficiently.
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.