Find the dates a backfill needs to cover

Python data engineering interview problem. Difficulty: beginner. Pattern: Date Functions. About 12 minutes. Free to practice.

A daily job is supposed to run once for every date. A backfill means running it again for the days it missed. Today you want to find out which days still need a run, so you can schedule them.

Write a function missing_dates(start, end, completed). start and end are dates written as 'YYYY-MM-DD' text, and both are included in the range. completed is a list of the dates that already ran. Return a list of the dates between start and end (inclusive) that are not in completed, in order from the earliest to the latest. Dates are returned as 'YYYY-MM-DD' text too. For '2026-08-01' to '2026-08-05' with ['2026-08-01', '2026-08-03'] already done, the days still to run are the 2nd, the 4th and the 5th. Keep the print lines at the bottom of the editor. The grader reads what your code prints.

Requirements

  • Include every date from start to end, with both ends counted.
  • Leave out the dates that are in completed.
  • Return the dates in ascending order.
  • Return dates as 'YYYY-MM-DD' strings.

Constraints

  • start and end are valid dates, and start <= end.
  • completed can contain dates outside the range. Ignore those.
  • Keep the print lines, because the grader reads the printed output.

Examples

Input: missing_dates("2026-08-01", "2026-08-05", ["2026-08-01", "2026-08-03"]) Output: ['2026-08-02', '2026-08-04', '2026-08-05'] This is the expected return value for the given call.

Topics: orchestration, backfill, dates.

More Python interview questions · All interview problems · Learn data engineering

beginner

Find the dates a backfill needs to cover

Production ticket: A DAG was paused for a few days. Before you flip it back on, you need the exact list of days it missed.

A daily job should have run once for every date between `start` and `end` (both inclusive). Some days already ran - they're in `completed`. Write `missing_dates(start: str, end: str, completed: list[str]) -> list[str]` returning the dates in that range that still need a backfill run, in order. Dates are `"YYYY-MM-DD"` strings. Keep the prints at the bottom. The grader reads stdout.