Minimum calorie stretch
Your task
A workout app logs calories burned per minute as positive integers. A recovery planner wants the fewest consecutive minutes whose calories total at least target. Given the per-minute list burns and the positive target, return that minimum stretch length, or 0 if even the whole session falls short. Grow the window from the right and shrink it greedily from the left. Example: burns = [4, 2, 3, 6, 2], target = 8 gives 2 (6 + 2, or 3 + 6 is 9).
Examples
shortest_burn_window(burns: list[int], target: int) -> intExample 1
Input
shortest_burn_window([4, 2, 3, 6, 2], 8)Output
2