Find a User's Airport at a Given Time from Flight Records
Quick Overview
This Ramp software engineering question tests timeline reasoning from flight records to determine a user's airport at a given time. It is useful for practicing interval logic, event ordering, and careful treatment of incomplete or boundary-case itinerary data.
Find a User's Airport at a Given Time from Flight Records
Company: Ramp
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
Given flight records with departure airport, departure time, arrival airport, arrival time, and user id, implement a function that returns where a given user is at a specified time. The answer should account for whether the user is at an airport or currently in flight.
### Constraints & Assumptions
- Flight intervals for a user do not overlap unless clarified.
- Times can be compared after parsing into a single timezone.
- The input may contain records for many users.
- Return values should distinguish airport, in-flight, and unknown states.
### Clarifying Questions to Ask
- If the query time is exactly the departure time, is the user at the origin or in flight?
- If it is exactly the arrival time, is the user at the destination?
- Should the function return the flight id when in flight?
- Can users have connecting flights or missing initial location?
- How large is the input?
### What a Strong Answer Covers
```premium-lock What a Strong Answer Covers
```
### Follow-up Questions
- How would you support many repeated queries?
- How would delays or cancellations change the model?
- How would you handle time zones?
- How would overlapping records be detected?
Quick Answer: This Ramp software engineering question tests timeline reasoning from flight records to determine a user's airport at a given time. It is useful for practicing interval logic, event ordering, and careful treatment of incomplete or boundary-case itinerary data.
Given flight records with departure airport, departure time, arrival airport, arrival time, and user id, implement a function that returns where a given user is at a specified time. The answer should account for whether the user is at an airport or currently in flight.
Constraints & Assumptions
Flight intervals for a user do not overlap unless clarified.
Times can be compared after parsing into a single timezone.
The input may contain records for many users.
Return values should distinguish airport, in-flight, and unknown states.
Clarifying Questions to Ask
If the query time is exactly the departure time, is the user at the origin or in flight?
If it is exactly the arrival time, is the user at the destination?
Should the function return the flight id when in flight?
Can users have connecting flights or missing initial location?
How large is the input?
What a Strong Answer Covers Premium
Follow-up Questions
How would you support many repeated queries?
How would delays or cancellations change the model?