Sliding Window Maximum (Algorithms)

Programming Interview Medium 5 views
Back to Questions

Problem Description

For each testcase you get n, k and n numbers. Output max of each window of size k (space-separated).

Input Format

First integer t. For each: n k then n integers.

Output Format

t lines window maximums.

Sample Test Case

Input:
1 8 3 1 3 -1 -3 5 3 6 7
Output:
3 3 5 5 6 7

Constraints

Sum of n over all testcases

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next