Skip to content

Latest commit

 

History

History

Maximum of All SubArrays of Size k

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given an array and an integer k, find the maximum for each and every contiguous subarray of size k.

Input :
arr[] = {1, 2, 3, 1, 4, 5, 2, 3, 6}
k = 3 
Output :
3 3 4 5 5 5 6

Input :
arr[] = {8, 5, 10, 7, 9, 4, 15, 12, 90, 13}
k = 4 
Output :
10 10 10 15 15 90 90