Halloween SalePremium questions, over 30% offUnlock all premium questions for over 30% off
Distribution Center Placement
Medium
A logistics company is expanding its distribution network along a single highway. You are given an array of integers locations representing the coordinates of candidate hub sites. Find the optimal hub coordinate to place a distribution center that minimizes total shipping distance to all sites.
Return a two-element list [hub, totalDistance] where hub is chosen from locations to minimize totalDistance = sum of |hub - locations[i]| over all i. If multiple hub coordinates give the same minimum total distance, choose the smaller one.
...
More LinkedIn interview questions
- Manual String Substitutionmedium
- Combine N-ary Treeshard
- Balanced Parentheseseasy
- Words From Phone Numbermedium
- Circular Signal Windowmedium
- Minimum Cost To Decorate Cakesmedium
- Dependency Task Executormedium
- Daily Branch Pruningmedium
OfferRetriever
Master technical interviews with real questions from top companies. Build your confidence and career.
LEGAL
© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.