Skip to content
C

Maximum Element in Every Window

Mediumjavapythonccppjavascript

Given an integer array and a window size K, find the maximum element in every contiguous window of size K.

Input Format

The first line contains two integers N and K. The second line contains N space-separated integers.

Output Format

Print the maximum of each window (left to right), separated by single spaces.

Input (stdin)

Output

Run your code to see output here...