← supio Interview Insights

supio·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Interviewed for a Software Engineer role at Supio, two coding problems back to back. Nothing too wild but the first problem took me longer than I'd like to admit to wrap my head around.

Questions Asked (2)

Q1

You have two arrays representing planes: their starting altitude and how fast they descend each second. Each second you can shoot down one plane before descent happens. If any plane's altitude hits zero or below after descending, the game ends. What's the maximum number of planes you can shoot before one lands?

Algorithms & Data Structures
Author's notes

This one tripped me up more than it should have.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as scheduling: each plane has a deadline equal to the number of seconds until it lands (altitude / descent rate, rounded up). To maximize the number of planes shot, sort planes by deadline and greedily shoot the one with the earliest deadline each second, skipping any that have already landed. This is equivalent to the classic 'maximum number of tasks completed before deadlines' problem, solvable with a min-heap or sorting.

Pro tip: Clarify edge cases upfront: planes with zero or negative initial altitude, zero descent rate, and whether shooting happens before or after descent. Also, mention that if a plane's deadline is less than or equal to the current second, it cannot be shot and the game ends if it lands.

1. Understand the problem and constraints

Restate the problem: each second, you can shoot one plane before all planes descend. If any plane's altitude becomes ≤0 after descent, the game ends. You want to maximize the number of planes shot before that happens.

2. Compute deadlines for each plane

For each plane, calculate the number of seconds it can survive: deadline = ceil(altitude / descent_rate). If descent_rate is 0, the plane never lands (infinite deadline). If altitude ≤0 initially, it has already landed.

3. Sort planes by deadline

Sort the planes in ascending order of their deadlines. This helps in prioritizing planes that will land sooner.

4. Greedily shoot planes using a min-heap or simulation

Iterate through seconds, and at each second, among available planes (those not yet shot and with deadline > current second), shoot the one with the smallest deadline. Use a min-heap to efficiently select the next plane to shoot.

5. Count and return the maximum number of planes shot

Continue until no more planes can be shot without causing a landing. The count of shot planes is the answer. If a plane's deadline is ≤ current second and it hasn't been shot, the game ends.

Key Points to Mention

  • Deadline calculation: ceil(altitude / descent_rate), with special handling for zero descent rate and non-positive initial altitude.
  • Greedy strategy: always shoot the plane with the earliest deadline first (Earliest Deadline First scheduling).
  • Use of a min-heap (priority queue) to efficiently select the next plane to shoot.
  • Time complexity: O(n log n) due to sorting and heap operations, where n is the number of planes.
  • Edge cases: planes that never land (descent_rate = 0), planes that have already landed (altitude ≤ 0), and simultaneous deadlines.
  • Simulation approach: iterate second by second, but optimize by jumping to the next relevant second if needed.

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

Q2

Given a list of user events as (userId, timestamp) pairs and a timeout value, group each user's events into sessions where consecutive events within the timeout window belong to the same session. Return the total session count across all users.

Algorithms & Data Structures
Author's notes

Pretty clean once you sort per user and scan through.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the input format and edge cases, then propose sorting events by userId and timestamp. Use a hash map to track the last timestamp per user and count sessions when the gap exceeds the timeout. Analyze time and space complexity, and discuss potential optimizations for large-scale data.

Pro tip: Mention that if events are already sorted or can be processed in a streaming fashion, you can avoid sorting and use a single pass with O(n) time. Also, highlight the importance of handling users with no events and the timeout boundary condition (>= vs >).

1. Clarify requirements and edge cases

Ask about input size, whether events are sorted, and the exact timeout condition (inclusive or exclusive). Confirm that sessions are per-user and that a new session starts when the gap exceeds the timeout.

2. Choose data structures and algorithm

Sort events by userId and timestamp, then iterate while tracking the last timestamp per user. Alternatively, use a hash map to store the last event time for each user and process events in any order if sorting is not required.

3. Implement session counting logic

For each event, if the user is new or the time difference from the last event exceeds the timeout, increment the session count and update the last timestamp. Otherwise, just update the last timestamp.

4. Analyze complexity and discuss optimizations

State that sorting takes O(n log n) time and O(n) space, while the counting pass is O(n). If events are already sorted or can be streamed, the overall time can be O(n). Mention memory considerations for large user bases.

5. Test with examples and edge cases

Walk through a small example, including cases with multiple users, gaps exactly equal to the timeout, and users with a single event. Verify the session count matches expectations.

Key Points to Mention

  • Sorting events by userId and timestamp to group per-user events efficiently
  • Using a hash map to track the last event timestamp per user
  • Session increment condition: gap > timeout (or >= depending on definition)
  • Time complexity: O(n log n) due to sorting, or O(n) if already sorted/streamed
  • Space complexity: O(n) for sorting or O(u) for hash map where u is number of users
  • Handling edge cases: empty input, single event, multiple users, exact timeout boundary

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