Implement one-cluster k-means
Company: Sealth
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Onsite
Quick Answer: This question evaluates understanding of clustering algorithms and optimization of within-cluster squared error for the special case k = 1, along with the ability to implement a numerical solution in d-dimensional space.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([(0,0),(2,2),(4,4)],)
Expected Output: [2.0, 2.0]
Explanation: Centroid is the coordinate-wise mean.
Input: ([(1,2,3)],)
Expected Output: [1.0, 2.0, 3.0]
Explanation: Single point centroid is itself.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.