AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
You are given an integer array `heights` representing the heights of buildings, some `bricks`, and some `ladders`. You start your journey from building `0` and move to the next building. While moving from `heights[i]` to `heights[i+1]`: if `heights[i] >= heights[i+1]`, you don't need bricks or ladders. If `heights[i] < heights[i+1]`, you can either use one ladder or `(heights[i+1] - heights[i])` bricks. Return the furthest building index (0-indexed) you can reach if you use the given ladders and bricks optimally.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.