Code Room
CodingEasycod-g1423
Subject Sliding windowLevel Entry–Mid~11 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.