Price Half-Hourly Smart Meter Reads Under a Time-of-Use Tariff

Last updated: November 29, 2026

Quick Overview

Given a list of half-hourly smart meter readings (timestamp, kWh) and a time-of-use tariff made of daily rate bands, some of which wrap past midnight, compute the customer's bill in pence including a daily standing charge.

Fuse Energy
Coding & Algorithms
Software Engineer
Fuse Energy
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of half-hourly smart meter readings (timestamp, kWh) and a time-of-use tariff made of daily rate bands, some of which wrap past midnight, compute the customer's bill in pence including a daily standing charge.

Fuse sells multi-rate and time-of-use tariffs, so turning half-hourly consumption into a bill is the bread and butter of its retail platform. A phone screen uses this to check clean parsing, careful interval logic (an off-peak band such as 23:30 to 07:30 wraps midnight) and money handling.

What the Interviewer Expects
  • Map each reading to exactly one tariff band, including bands that wrap midnight
  • Charge the standing charge once per supply day, not once per reading
  • Fail loudly when a reading falls outside every band rather than pricing it at zero
  • Discuss rounding and integer pence versus floats for money
  • Keep the solution linear in the number of readings
Key Topics to Cover
Time-of-use tariffs
Interval mapping
Midnight wrap-around
Money rounding
Half-hourly settlement
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 handle the clock-change days that have 46 or 50 settlement periods?
  • The tariff changes mid-month. How do you price reads against the tariff version in force at each timestamp?
  • How would you precompute a 48-slot rate array to make pricing O(1) per read?
  • What changes if the standing charge applies to days with no reads too?
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: readings as (iso_timestamp, kwh), tariff bands as (start 'HH:MM', end 'HH:MM', pence_per_kwh) that together cover 24 hours, and a standing charge in pence per day. Output: total pence. A ba...

High-Level Design

Convert each band to minutes since midnight. For each reading, find the band whose half-open interval contains the reading's start minute; for a wrapping band the test is `minute >= start or minute < ...


Submit Your Answer
Markdown supported

Related Questions