Hand-Written K-Means
Asked at Microsoft · Coding Questions · Difficulty: Medium · Last asked Feb 13, 2026
Implement K-Means from scratch in numpy / PyTorch / plain Python. The Microsoft HM (Applied Scientist 2) phone screen routinely opens with this; sometimes followed by a time-complexity discussion.
Loading the problem…
More Microsoft interview questions
- LLM conceptual questions
- Tiny Next-Token Prediction Model (PyTorch Fill-In)
- Roofline Analysis and Mixed-Precision Gradients for Matmul
- Design Search Autocomplete / Typeahead
- Design a Chatbot Personalization / Memory System
- Design a Job Scheduler / ETL Pipeline