Compute Peak Fifteen Minute Demand From Interval Energy Data

Last updated: November 29, 2026

Quick Overview

Given 5-minute interval energy readings (kWh) for a site, compute the peak demand in kW over any rolling 15-minute window of consecutive intervals and the window start, skipping windows that span a data gap.

Schneider Electric
Coding & Algorithms
Software Engineer
Schneider Electric
November 29, 2026
Software Engineer
Online Assessment
Coding & Algorithms
Easy

0

0

0 solved


Given 5-minute interval energy readings (kWh) for a site, compute the peak demand in kW over any rolling 15-minute window of consecutive intervals and the window start, skipping windows that span a data gap.

Utility tariffs bill commercial sites on peak demand, and demand reporting is a standard feature in Schneider energy management software. This online assessment style problem checks sliding windows, unit conversion from kWh to kW, and careful gap handling.

What the Interviewer Expects
  • Uses a fixed-size sliding window rather than recomputing sums
  • Converts energy over the window into average power correctly
  • Resets the window on a gap instead of summing across missing data
  • Returns the window start for the peak
  • Handles fewer intervals than a full window
Key Topics to Cover
sliding window
deque
unit conversion
demand charges
data gaps
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
  • The utility uses fixed (block) 15-minute windows instead of rolling ones. What changes?
  • How would you compute the monthly billing peak per site for 50,000 sites in Spark?
  • How should a partially missing window be treated for billing versus for dashboards?
  • How would you alert in real time when the site is about to set a new monthly peak?
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

Input: list of (minute, kwh) sorted by minute, each covering [minute, minute+5). Window: 15 minutes, so three consecutive intervals. Demand in kW is energy in the window divided by window length i...

High-Level Design

Keep a deque of the last intervals and a running sum. If the next reading is not exactly 5 minutes after the last one, a gap exists and the window restarts, since a missing interval would understate d...


Submit Your Answer
Markdown supported

Related Questions