← Supio Interview Insights

Supio·Frontend Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Got a coding problem at Supio for a frontend engineer role. One algorithmic question, felt more like a backend/algo screen than anything frontend related.

Questions Asked (1)

Q1

You have two arrays: one with the current altitudes of planes, and one with how fast each plane descends per second. You can shoot down at most one plane per second. What's the maximum number of planes you can take down before any of them hit the ground?

Algorithms & Data Structures
Author's notes

Took me a minute to see it as a greedy scheduling problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints and edge cases, then propose a greedy algorithm that prioritizes planes with the least time before hitting the ground. Simulate second by second, shooting the most urgent plane, and count successful shots.

Pro tip: Always discuss time complexity and potential optimizations (like using a priority queue) to show algorithmic maturity. Also, mention how you'd handle ties or simultaneous impacts.

1. Clarify the problem

Ask questions to confirm assumptions: Can planes have the same altitude? What if a plane hits the ground at the same second you shoot? Is descending speed constant? Can you shoot a plane that has already hit the ground?

2. Define urgency

For each plane, compute the time until it hits the ground: time = altitude / descent_rate. Planes with smaller times are more urgent and should be prioritized.

3. Greedy strategy

At each second, shoot the plane with the smallest time-to-ground among those still airborne. This greedy choice is optimal because delaying a more urgent plane could cause it to crash.

4. Simulation and counting

Simulate second by second: decrement altitudes, remove planes that hit the ground, and shoot one plane per second. Count successful shots until no planes remain or all remaining planes will hit before you can shoot them.

5. Optimization and complexity

Use a min-heap (priority queue) keyed by time-to-ground to efficiently select the next plane to shoot. The time complexity is O(n log n) due to heap operations, which is optimal for this problem.

Key Points to Mention

  • Greedy algorithm: always shoot the most urgent plane first.
  • Time-to-ground calculation: altitude divided by descent rate.
  • Priority queue (min-heap) for efficient selection.
  • Edge cases: planes with zero altitude, simultaneous impacts, ties in urgency.
  • Time complexity: O(n log n) and space complexity O(n).
  • Proof of optimality: exchange argument showing greedy choice is safe.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.