Reported February 2024
Microsoftarray

Find Array Uniqueness Median

Reported by candidates from Microsoft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Microsoft OA. Under 2s to a working solution.
Founder's read

Microsoft asked this in February 2024 and it's a median problem wrapped in array language. You've got an array, and the question wants you to find something median-related about uniqueness. The trap is overthinking it. Most candidates freeze because 'median' sounds statistical, but here it's usually just sorting and picking the middle value after some transformation. StealthCoder will catch you if you blank on the edge case around even-length arrays or off-by-one indexing.

Pattern and pitfall

The core pattern is array manipulation with sorting. You'll transform the input (probably count unique elements or track frequencies), then sort that result and extract the median. The trick: when the array length is even, many candidates pick the wrong middle index or average when they shouldn't. The gotcha is that 'uniqueness' likely means you're working with a derived array (unique counts, unique values), not the raw input. Sorting is O(n log n), and the median lookup is O(1) after that. If you freeze during the OA, StealthCoder reads the problem and feeds you the sorting approach so you don't lose points on a time-out.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Find Array Uniqueness Median cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as median of two sorted arrays. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Microsoft's OA.

Microsoft reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find Array Uniqueness Median FAQ

What does 'uniqueness' actually mean in this context?+

It almost certainly means you count the frequency of each element, or extract only unique values, then find the median of that derived array. You're not finding the median of the original array directly.

Do I have to handle even-length arrays differently?+

Yes. For even-length arrays, check the problem statement carefully. Some ask for the lower middle, some the upper middle, some the average. Most OAs specify. If you blank, assume lower middle (length / 2 - 1).

Is this really just sort and pick the middle?+

Yes. No fancy data structure needed. Sort, find the median index, return the value. The complexity is O(n log n) from sorting. If you're thinking heaps or segment trees, you're overcomplicating.

How much time do I actually have?+

The problem doesn't specify a reported time limit. Aim to code and test in under 15 minutes. Sorting and indexing are fast to implement if you're not second-guessing yourself.

Will there be large arrays or weird edge cases?+

Microsoft OAs typically include edge cases like empty arrays, single elements, or all duplicates. Handle those first before submitting. Test with a simple example on paper.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Microsoft.

OA at Microsoft?
Invisible during screen share
Get it