Schedule Fleet EV Charging Under a Site Power Cap

Last updated: November 29, 2026

Quick Overview

Given half-hourly prices, a per-slot site import cap, and a set of EVs each with an arrival slot, departure slot, energy needed and maximum charge rate, find the minimum-cost charging schedule that meets every EV's demand, or report that none exists.

Fuse Energy
Coding & Algorithms
Software Engineer
Fuse Energy
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given half-hourly prices, a per-slot site import cap, and a set of EVs each with an arrival slot, departure slot, energy needed and maximum charge rate, find the minimum-cost charging schedule that meets every EV's demand, or report that none exists.

Fuse installs EV chargers and controls distributed energy, and smart charging has to respect both customer deadlines and a connection limit while chasing cheap slots. This hard onsite problem tests whether you can see past greedy heuristics to a network flow formulation and implement min-cost flow correctly.

What the Interviewer Expects
  • Show a counterexample or argument for why cheapest-slot-first per EV can fail globally
  • Model as a transportation problem: EVs to slots to sink with capacities
  • Implement min-cost max-flow with a shortest-path method that tolerates negative residual costs
  • Detect infeasibility when max flow is below total demand
  • Analyse complexity in terms of EVs, slots and total energy
Key Topics to Cover
Min-cost flow
Transportation problem
Smart charging
Capacity constraints
Feasibility detection
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 return the actual per-EV, per-slot schedule?
  • How does the model change if exporting from EV batteries (V2G) is allowed?
  • With 10,000 chargers and 48 slots, what would you use instead of a hand-rolled flow (LP solver, successive shortest paths with potentials)?
  • How would you re-plan when a car leaves earlier than declared?
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: prices[t], site_cap[t] (kWh per slot), and EVs (arrive, depart_exclusive, kwh_needed, max_kwh_per_slot) with integer units. Output: minimum total cost, or None if any EV cannot be full...

High-Level Design

Build a graph: source to each EV with capacity kwh_needed, cost 0; EV to each slot in its window with capacity max_rate, cost price[t]; each slot to sink with capacity site_cap[t], cost 0. A f...


Submit Your Answer
Markdown supported

Related Questions