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
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

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
heaps
greedy
exchange argument
Minecraft scenario
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample Answer
Requirements
  • heights: list of pillar heights; start at index 0.
  • Climb cost: d blocks or 1 ladder for an upward step of d.
  • 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...


Submit Your Answer
Markdown supported