Furthest Building You Can Reach
Medium
Heap Scheduling Problems
You walk across buildings of the given heights. Moving to a lower or equal building is free; moving up costs the height difference in bricks, or one ladder (any height). With the given bricks and ladders, print the furthest building index you can reach.
Constraints
1 <= n <= 10^5 0 <= bricks <= 10^9 0 <= ladders <= n
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.