Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Find a coordinate from the input array that minimizes the sum of absolute distances to all other coordinates.
The optimal location is mathematically equivalent to the median of the dataset.
Return both the selected coordinate and the computed minimum total distance.
What This Tests
L1 norm minimization and median properties
Linear-time selection via partitioning (Quickselect)
In-place array manipulation and pointer techniques
Complexity analysis comparing O(N log N) vs O(N) approaches
Common Patterns
Divide and Conquer
Two Pointers
Sorting
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected