Took me a minute to realize this is basically a scheduling problem.
Model each plane as a deadline: the time it hits the ground is ceil(altitude / descent_rate). The problem reduces to scheduling unit-time jobs with deadlines to maximize on-time jobs, solved greedily by always shooting the plane with the earliest deadline. Sort planes by deadline and simulate, keeping track of the current time.
Pro tip: Clarify edge cases upfront: if a plane's altitude is 0, it's already down; if descent rate is 0, it never hits the ground and can be ignored or shot anytime. Also, mention that the greedy choice is optimal because it's a classic exchange argument.
Restate the problem: each plane has a deadline (time it hits the ground) and you can shoot at most one plane per second. You want to maximize the number of planes shot before their deadlines.
For each plane, calculate the time it hits the ground as ceil(altitude / descent_rate). If descent_rate is 0, the plane never hits the ground; treat its deadline as infinity.
Sort the planes in ascending order of their deadlines. This ensures you consider the most urgent planes first.
Iterate through the sorted planes, maintaining the current time (starting at 0). For each plane, if current time < deadline, shoot it (increment count) and increment current time by 1. Otherwise, skip it.
The total number of planes shot is the maximum possible. Explain why this greedy approach is optimal (exchange argument).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.