A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L3
Problem
Given a list of trip dicts (each with user_id, destination, duration_hours), per user_id return user_id, total_hours = SUM(duration_hours), unique_destinations = count of distinct destinations. Return a list of dicts sorted alphabetically by user_id.
Summary
Travel records hold patterns waiting to be surfaced.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.