Dsa
Sliding Window
Easy
Maximum Sales in a Week
You are given a list of daily sales (integers) for a week. Write a function that calculates the maximum total sales over any continuous subarray of length 'k'. The input consists of two lines: the first line contains the integer 'k', and the second line contains the list of daily sales. Return the maximum sales as an integer.
Example:
Input:
3
10 6 8 5 9 12 15
Output:
34
Key concepts
sliding_windowarraysum
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now