← Questions

Remove the fewest distinct values to delete half the array

0
MicrosoftCodingLast asked Aug 2026

A coding interview question asked in Microsoft's coding round, last asked Aug 2026. It tests greedy, hashing and sorting.

You may pick a set of distinct values from an integer array; picking a value deletes every occurrence of it. Return the size of the smallest set whose deletions remove at least half of the array.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Microsoft · Coding · Last asked Aug 202660 min · Ten to fifteen minutes of behavioral questions, then coding in HackerRank where you write a main and make the tests pass; usually three rounds · No AI unless the interviewer invites it; some 2026 loops add a round where you bring your own AI agent

What it tests

greedy · hashing · sorting

Your code and the AI tutor open when you unlock this question.