#26

Ads Platform Best 7-Day Spend Window

EASYSliding WindowPYTHON

Problem Description

An ads analytics pipeline identifies the peak 7-day budget window for a campaign by scanning daily spend values with a sliding window aggregator. Given a list of daily spend values (integers), find the 7-day consecutive window with the maximum total spend. Return a tuple of `(start_index, max_total_spend)`. If the list has fewer than 7 elements, return `None`. **Input:** `spends` — a list of integers representing daily spend values. **Output:** A tuple `(start_index, max_total_spend)` for the best 7-day window, or `None` if the list has fewer than 7 elements.

Topics

arraysliding window

Asked at Companies

doordash

Solve This Problem

Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.

Start Solving →