PracHub
QuestionsLearningGuidesInterview Prep
|Home/Machine Learning/Atlassian

Minimize max L1 radius with k centers in 1D

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving skills and understanding of clustering and optimization concepts, specifically the 1D k-center (minimax L1) problem, greedy feasibility tests, binary-search-on-answer techniques, numerical stability with large coordinates, and time/space complexity analysis relevant for a Data Scientist role.

  • medium
  • Atlassian
  • Machine Learning
  • Data Scientist

Minimize max L1 radius with k centers in 1D

Company: Atlassian

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Take-home Project

You are given an array A of n integers (values may be negative and may repeat) and an integer k (1 ≤ k ≤ n). Place k cluster centers anywhere on the real line to minimize the maximum L1 distance (absolute value) from any data point to its nearest center. Return this minimized maximum distance r*. Design an algorithm faster than O(nk). Requirements: 1) Sort A and use a decision version that, for a candidate radius r, greedily covers points with intervals of length 2r to check if ≤ k centers suffice; then binary-search the smallest feasible r on [0, max(A)-min(A)]. Aim for O(n log R) time, where R is the search range, and O(1) extra space beyond the sorted array. 2) Output both r* and one valid set of k center positions achieving r*; centers may be any real numbers. 3) Prove correctness of the greedy feasibility test and the binary search, and argue why centers need not be restricted to data points to achieve the optimal r* (but also discuss whether restricting centers to data points changes r* in 1D under L1, and how the algorithm would adapt if such a restriction were imposed). 4) Handle large coordinates up to 1e9 and n up to 2e5; ensure numerical stability if r* is half-integer. 5) Provide worked examples, including duplicates and tightly clustered vs. widely separated points, and give exact r* values for those cases. Analyze time and space complexity.

Quick Answer: This question evaluates algorithmic problem-solving skills and understanding of clustering and optimization concepts, specifically the 1D k-center (minimax L1) problem, greedy feasibility tests, binary-search-on-answer techniques, numerical stability with large coordinates, and time/space complexity analysis relevant for a Data Scientist role.

Related Interview Questions

  • Train and evaluate logistic model with regularization - Atlassian (medium)
  • Minimize L1 Distance with k Cluster Centers in Array - Atlassian (medium)
|Home/Machine Learning/Atlassian

Minimize max L1 radius with k centers in 1D

Atlassian logo
Atlassian
Oct 13, 2025, 9:49 PM
mediumData ScientistTake-home ProjectMachine Learning
6
0

You are given an array A of n integers (values may be negative and may repeat) and an integer k (1 ≤ k ≤ n). Place k cluster centers anywhere on the real line to minimize the maximum L1 distance (absolute value) from any data point to its nearest center. Return this minimized maximum distance r*. Design an algorithm faster than O(nk). Requirements: 1) Sort A and use a decision version that, for a candidate radius r, greedily covers points with intervals of length 2r to check if ≤ k centers suffice; then binary-search the smallest feasible r on [0, max(A)-min(A)]. Aim for O(n log R) time, where R is the search range, and O(1) extra space beyond the sorted array. 2) Output both r* and one valid set of k center positions achieving r*; centers may be any real numbers. 3) Prove correctness of the greedy feasibility test and the binary search, and argue why centers need not be restricted to data points to achieve the optimal r* (but also discuss whether restricting centers to data points changes r* in 1D under L1, and how the algorithm would adapt if such a restriction were imposed). 4) Handle large coordinates up to 1e9 and n up to 2e5; ensure numerical stability if r* is half-integer. 5) Provide worked examples, including duplicates and tightly clustered vs. widely separated points, and give exact r* values for those cases. Analyze time and space complexity.

Loading comments...

Browse More Questions

More Machine Learning•More Atlassian•More Data Scientist•Atlassian Data Scientist•Atlassian Machine Learning•Data Scientist Machine Learning

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.