The Intervals
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 date strings in 'YYYY-MM-DD' format, bucket each date into a 7-day week starting from the earliest date. Week 1 covers days 0-6 after the min date; week 2 covers days 7-13; etc. Return a dict mapping the week number (as a string key) to the list of dates that fell in that week, preserving input order within each bucket.
Summary
Timestamps in buckets.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.