O06

Dense Window Maximum

Mid / Senior Engineer
Target Time: 25 - 35 Minutes
Type: NUMERIC

Problem Statement & Objective

Given an array of server transaction metrics and an integer window size k, compute the maximum sum of any contiguous window of size k.

Function Signature (Python)

busiest_window(timestamps: list[int], window: int) -> int

Input & Output Contract

Output Rule:Maximum sum integer among all sliding windows of size k.

System Constraints

1 <= k <= dizi.length <= 10^5
-10^4 <= dizi[i] <= 10^4

Example Execution Walkthrough

dizi = [2, 1, 5, 1, 3, 2], k = 3
windows: [2,1,5]=8, [1,5,1]=7, [5,1,3]=9, [1,3,2]=6 -> max is 9

Example Test Scenarios (3)

Example 1
Input:[[1,2,3,10,11,12,13],3]
Expected Output:1
Example 2: [10, 13) Aralığı
Input:[[10,11,12,20],3]
Expected Output:10
Example 3: Ayrık İstekler
Input:[[1,5,9],2]
Expected Output:1
Loading Python Editor...
Input Parameters
[
  [
    1,
    2,
    3,
    10,
    11,
    12,
    13
  ],
  3
]
Expected Output
1