Question
A habit tracker stores, for each day, a 1 if the user hit their step goal and a 0 if not. For a k-day challenge recap (1 <= k <= number of days), the app shows the best window: the maximum number of goal-hit days in any k consecutive days. Given the binary list flags and k, return that maximum. Example: flags = [0, 1, 1, 1, 0, 1], k = 3 gives 3 (days 1 through 3).
max_goal_days(flags: list[int], k: int) → int[[0,1,1,1,0,1],3]out3State 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.