Reported August 2024
Microsoftsorting

Min Order

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

You're looking at a Microsoft OA from August 2024 with a sorting problem disguised as an order-processing question. The trick here is recognizing what metric you're actually sorting on. Most candidates default to the wrong dimension and waste time on a solution that technically works but fails the hidden test cases. StealthCoder will catch the pattern in seconds if you blank under pressure, but understanding the logic now means you won't need it.

Pattern and pitfall

Min Order is a sorting problem where the naive approach is to sort by quantity or price, but the actual ask is usually to optimize by a composite metric: often cost-per-unit or total spend to minimize order fragmentation. The gotcha is that candidates assume 'min' means fewest items or lowest unit cost, when the problem wants you to minimize total orders or cost variance across a set. Read the problem text carefully for the exact definition of 'min'. The pattern is pure sorting, possibly with a secondary key. Implement a custom comparator and iterate through examples before submitting. If you hit the wall on the OA, StealthCoder will surface the exact sort criteria and a working solution template in real time.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Min Order 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 would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ 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 would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Min Order FAQ

Is this a sorting problem or dynamic programming?+

Pure sorting. You're ordering items by some criteria to minimize a metric, not building an optimal substructure. The trick is identifying the right sort key, not inventing a DP state.

What's the most common wrong approach?+

Sorting by quantity or unit price first. Candidates miss that 'min' refers to total cost or order count, not individual item cost. Read the problem output definition three times before coding.

How much time should I spend on examples?+

Five minutes minimum. Walk through 2-3 test cases by hand and verify your sort order matches the expected output. This catches the wrong comparator fast.

Is this problem still asked at Microsoft in 2024?+

Yes. Sorting and order-optimization problems are stable in Microsoft OAs. The exact wording varies, but the core pattern (sort to optimize cost or count) repeats across batches.

Can I solve this in under 15 minutes?+

Easily, if you nail the sort key in the first two minutes. The implementation is five lines of sorting code plus validation. The risk is spending 10 minutes on the wrong comparator.

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