1478. Allocate Mailboxes
https://leetcode.com/problems/allocate-mailboxes
Description
Given the array houses and an integer k. where houses[i] is the location of the ith house along a street, your task is to allocate k mailboxes in the street.
Return the minimum total distance between each house and its nearest mailbox.
The answer is guaranteed to fit in a 32-bit signed integer.
Example 1:

Example 2:

Example 3:
Example 4:
Constraints:
n == houses.length1 <= n <= 1001 <= houses[i] <= 10^41 <= k <= nArray
housescontain unique integers.
ac
Previous1477. Find Two Non-overlapping Sub-arrays Each With Target SumNext1479. Sales by Day of the Week
Last updated
Was this helpful?