Available question text
Place k mailboxes on a line to minimize the sum of distances from each house to its nearest mailbox; optimal placement partitions the sorted houses into k contiguous groups served by a mailbox at each group's median, solvable by dynamic programming with precomputed interval costs.
Related questions
Continue with questions that share topics or the same question type.
- Leftmost-Fit Memory Allocator: Allocate Consecutive Units and Free by Owner
Coding · Data Structure Design · Trees
- 0/1 Knapsack Problem with Time Complexity Optimization
Coding
- 01 Matrix
Coding
- 1 leetcode hard complex dp questions
Coding
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
Amazon
Leetcode 1478. Allocate Mailboxes
Interview reported: Sep 25, 2024 · 2 source reports
MID_LEVEL, SENIOR
Source snapshot: Nov 12, 2026
View source