← Problems93. Days the feed never deliveredMediumPySpark
00:00 / 20:00

Days the feed never delivered

MediumNot attempted yetAsked at Microsoft, TCS

Each source is supposed to land once a day. Before anyone trusts a monthly total, they want the days that never arrived.

Input

loads source string -- 'orders', 'returns', ... load_date string -- 'YYYY-MM-DD'

A source can land twice on one day. A day it missed has no row at all, which is the whole problem.

Output

One row per missing day per source:

  • source
  • missing_date — 'YYYY-MM-DD'

A day is missing when it falls between that source's earliest and latest load and has no row. Report nothing outside that range — before a source's first load it did not exist yet, and after its last there is nothing to say.

Example

sourcemissing_date
orders2024-01-02

Constraints

  • Every missing day, not the first one. A four-day silence is four rows.
  • Sources are independent, and their ranges differ.
  • Two loads on one day are one delivered day, not a duplicate.
  • A source that never missed a day contributes no rows. An empty result is a correct answer.
  • Row order is not graded. Column names and their order are.

Example 1one missing day

Input · loads
sourceload_date
orders2024-01-01
orders2024-01-03
Output
sourcemissing_date
orders2024-01-02

Example 2a complete run reports nothing

Input · loads
sourceload_date
orders2024-01-01
orders2024-01-02
orders2024-01-03
Output
no rows

Topics

anti-joindata qualitytime intelligence

Similar problems

Community-reported interview topic. Not an official company question and no affiliation is implied.

solution.py
Loading editor…
Draft not saved yet · Spaces 4 · UTF-8⌘↵ run ⌘⇧↵ submit
Nothing run yet

Run against the public tests, or submit to score against all of them.