Reported February 2025
Microsoftgreedy

Maximize Number Of Produced Cars

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's February OA asked candidates to maximize the number of produced cars, a constraint-satisfaction problem that looks simple on the surface but rewards careful state tracking. You're given factories, resources, or production timelines, and you need to find the optimal allocation. The trick isn't brute force. It's recognizing that greedy allocation or a well-structured simulation will beat you if you miss the dependency structure. StealthCoder reads the exact problem statement and feeds you the pattern in real time, so if you blank on whether to sort by capacity or by deadline, you have a hedge.

Pattern and pitfall

This problem typically combines greedy selection with dynamic programming or simulation. The candidate must identify what constrains production: is it raw material, factory slots, time windows, or multi-step assembly. Most candidates jump to sorting cars by some metric and assigning them greedily, which fails when one factory's output feeds another's input. The real solution often requires topological ordering of dependencies or a priority-queue-based simulation where you process events in order and track remaining capacity. Common pitfall: assuming all factories operate in parallel without bottleneck analysis. StealthCoder's real-time pattern detection catches this before you code a solution that passes examples but fails hidden cases. Focus on dependency edges and capacity constraints, not just raw throughput.

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 Maximize Number Of Produced Cars 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

⏵ 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.

Maximize Number Of Produced Cars FAQ

Is this a greedy problem or DP?+

Usually greedy by factory choice combined with simulation. You pick which factory runs next based on a heuristic (lowest wait time, highest output, earliest deadline), then simulate. DP appears if you need to track production combinations, but that's less common in this variant.

What's the trick Microsoft is testing?+

Understanding that naive greedy fails when factories have dependent inputs. You must either topologically sort the production pipeline or use a priority queue to simulate realistic constraints. Missing this means your code works on the example but not the hidden tests.

How do I prepare in 24 hours?+

Don't memorize solutions. Instead, sketch the dependency graph on paper. Ask yourself: can factory B start if A hasn't finished? Does material flow between them? Is there a bottleneck? These questions guide your approach faster than pattern-matching.

Should I sort the input?+

Probably, but sort by the right metric. Sorting by deadline, capacity, or completion time each produce different results. Read the problem carefully. If it's not obvious which metric, try deadline first, then capacity if that fails.

Is this still asked at Microsoft?+

Yes. Variant of it was reported in February 2025. Production optimization and resource allocation stay relevant because they test systems thinking and handling multiple constraints, which is core to backend and infrastructure roles.

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