Reported June 2024
Microsoft

Skycraper

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 June 2024 Skyscraper problem caught candidates off-guard because it looks like a straightforward grid traversal but pivots into a greedy or dynamic-programming decision tree. You're likely building heights or costs, comparing paths, and the trick is recognizing when a greedy local choice breaks the global optimum. If you blank on the exact DP formulation during the live OA, StealthCoder reads the problem statement and surface-level test cases to give you the state definition and recurrence. That hedge matters when the clock is ticking.

Pattern and pitfall

Skyscraper problems typically ask you to find the tallest structure you can build given constraints on placement, adjacency, or cost. The core pitfall is treating it as a simple max-value scan when it actually requires tracking state across positions or heights. You'll often need either greedy logic (always pick the next highest valid placement) or DP (state is position and current height, recur on valid next moves). Common mistake: not recognizing that you can't just sum independent choices. The pattern usually sits at the intersection of array traversal and optimization. During the real OA, if the recurrence relation isn't clicking, StealthCoder can extract it from the problem examples so you don't waste 15 minutes on the wrong approach.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Skycraper 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Skycraper FAQ

Is Skyscraper a pure DP problem or can greedy work?+

It depends on the constraint set. If the problem guarantees that picking the locally optimal (tallest or cheapest) next move never blocks a globally better solution, greedy works. Otherwise, you need DP with memoization. Test your greedy approach on small examples first. If it fails, pivot to DP immediately.

What's the most common wrong approach candidates submit?+

Treating it as a simple array max or sum. Candidates miss the state transition: you can't just add heights independently. The OA expects you to track which positions you've used and what constraints remain. Read the exact placement rules twice before coding.

Should I precompute anything to speed up the solution?+

Yes. If the grid or height array is large, precompute prefix sums or sorted heights depending on your approach. This cuts down on redundant lookups during DP. Also precompute any validity checks (e.g., can a building of height X fit at position Y).

How do I prepare for this in 48 hours without a full problem statement?+

Work through LeetCode problems on array DP and greedy optimization. Focus on problems where you build a sequence and can't reuse positions. Understand the difference between local and global optimality. Practice state design.

Is this still asked at Microsoft in 2024?+

Yes. Grid and building-height variants show up regularly in Microsoft OAs. The specific twist changes, but the core logic (greedy vs DP on constrained placement) remains. Expect it to reappear in the same pattern family.

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