Top-K Largest Elements (Retain / Rank Stores)
Asked at Microsoft · Coding Questions · Difficulty: Easy · Last asked May 15, 2026
Selecting the best few items from a collection is a building block of ranking systems. Implement two small selection functions: one that keeps the K largest numbers of a list while preserving their order, and one that ranks business candidates by a composite key.
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