Loading...
The Trip Aggregator
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- junior, mid
Problem
Given a list of trip records, each with a user ID, origin city, destination city, and trip duration in hours, compute the total travel time per user and the number of unique destinations each user visited. Return a list of dicts sorted by user ID, each containing user_id, total_hours, and unique_destinations.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.