Code RoomBest training block
EasyPrep Room Coding #620

Best training block

CodingAlgorithms & data structuresEntry–Mid~11 min

A step-tracking app highlights a user’s best training block. Given daily step counts steps (non-empty) and a block length k (1 <= k <= number of days), return the 0-based start index of the k-day stretch with the highest total steps. If several stretches tie, return the earliest. Maintain a running window sum instead of re-adding k values per position. Example: steps = [4000, 9000, 6000, 7000, 2000], k = 2 gives 1.

Implement
best_block_start(steps: list[int], k: int) → int
Examples
in[[4000,9000,6000,7000,2000],2]out1
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 11 min
InputExpectedGot
[[4000,9000,6000,7000,2000],2]1not run yetsample