Find Missing Settlement Periods in a Smart Meter Read Stream

Last updated: November 29, 2026

Quick Overview

Given an unsorted list of half-hourly read timestamps that may contain duplicates and a requested date range, return the missing half-hour periods as contiguous (first_missing, last_missing) ranges.

Fuse Energy
Coding & Algorithms
Data Engineer
Fuse Energy
November 29, 2026
Data Engineer
Technical Screen
Coding & Algorithms
Easy

0

0

0 solved


Given an unsorted list of half-hourly read timestamps that may contain duplicates and a requested date range, return the missing half-hour periods as contiguous (first_missing, last_missing) ranges.

Smart meter data arrives late, duplicated and with holes, and a supplier like Fuse must detect gaps before billing or settlement so it can request re-reads or estimate. The interviewer checks that you dedupe, sort and produce compact ranges instead of one row per missing slot.

What the Interviewer Expects
  • Deduplicate and sort timestamps before scanning
  • Emit contiguous ranges, not individual slots
  • Handle a gap at the very start and at the very end of the range
  • Ignore readings outside the requested window
  • State time and space complexity
Key Topics to Cover
Gap detection
Sorting and dedup
Range compression
Time series hygiene
Sentinel technique
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you run this over 300,000 meters every morning in SQL or Spark?
  • How do you treat reads that arrive with a non-aligned timestamp like 00:17?
  • Which gaps should trigger an on-demand read request versus estimation?
  • How would daylight saving days change the expected slot count?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Inputs: a list of ISO timestamps (interval starts, aligned to :00 or :30), and inclusive start, end. Output: a list of (first_missing, last_missing) pairs covering every absent slot, in order. D...

High-Level Design

Parse, filter to the window, put into a set to dedupe, then sort. Walk the sorted list keeping expected, the next slot we should see. If the current reading is later than expected, everything from...


Submit Your Answer
Markdown supported

Related Questions