New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
JobRadar
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
LinkedIn
Coding Question
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
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected