Furthest Minecraft Pillar Reachable With Limited Blocks and Ladders
Last updated: November 29, 2026
Quick Overview
A Minecraft player walks across a row of pillars left to right. Stepping down is free; climbing up by d costs d blocks or one ladder. Given block and ladder counts, return the furthest pillar index the player can reach.
Microsoft
November 29, 20260
0
0 solved
A Minecraft player walks across a row of pillars left to right. Stepping down is free; climbing up by d costs d blocks or one ladder. Given block and ladder counts, return the furthest pillar index the player can reach.
A greedy-with-heap question in the style of Microsoft technical screens, themed on Minecraft. The interviewer wants the candidate to see that ladders should cover the largest climbs seen so far, and that a min-heap lets that decision be revised as the walk goes on.
What the Interviewer Expects
- Notice ladders are worth most on the biggest climbs
- Tentatively give every climb a ladder, kept in a min-heap
- When ladders run out, pay the smallest ladder climb with blocks
- Stop at the first index where blocks go negative
- Compare with a binary search on the answer
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Solve it with binary search on the furthest index plus a sorting check. Which is faster?
- Return which climbs used ladders.
- Ladders now cover any climb up to height L only.
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
heights: list of pillar heights; start at index 0.- Climb cost:
dblocks or 1 ladder for an upward step ofd. - Output: largest reachable index....
High-Level Design
Deciding ladder or blocks at each climb greedily fails, because a bigger climb may come later. Instead, keep the climbs currently assigned to ladders in a min-heap. Push every new climb; if that makes...