The Hourly Bucket
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Given a list of event dicts (each with 'ts' in ISO format 'YYYY-MM-DDTHH:MM:SS' and 'type'), group by the hour prefix 'YYYY-MM-DDTHH' (first 13 characters of ts). Return a dict mapping each hour prefix to a list of 'type' values in original order.
Summary
Timestamps belong somewhere.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.