Pondo Minimum
Problem Statement
Pondo has an array of integers a of length n as well as an integer k. He wishes to form the array b of length n−k+1 by taking taking all the subarrays of length k and taking their minimums, i.e. bi=min0≤j≤k−1(ai+j).
Input Format
Your first line will contain two space-separated integers n and k. Your next line will contain n integers representing a.
Output Format
You should output n−k+1 integers representing b.
Constraints
- 1≤n≤105
- 1≤ai≤109
Sample Cases
10 5
10 9 8 7 6 5 4 3 2 1
6 5 4 3 2 1
10 4
684839257 302743967 551107459 232951579 483565957 241081121 553311714 547334166 25972405 997164454
232951579 232951579 232951579 232951579 241081121 25972405 25972405
Comments0
No comments yet
Be the first to comment.
New comment
Log in to join the discussion.