For this Question: Given an array A and an integer K. Find the maximum for each and every contiguous subarray of size K.


Problem asked in Amazon, Flipkart.The first line of each test case contains a single integer N denoting the size of array and the size of subarray K. The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array.

Constraints:
1 ≤ N ≤ 10^5
1 ≤ K ≤ N
0 ≤ A[i] <= 10^5Print the maximum for every subarray of size K.Sample Input:
9 3
1 2 3 1 4 5 2 3 6

Sample Output:
3 3 4 5 5 5 6

Explanation:
Starting from the first subarray of size k = 3, we have 3 as maximum. Moving the window forward, maximum element are as 3, 4, 5, 5, 5 and 6., I have written this Solution Code: n,k=input().split()
n=int(n)
k=int(k)
arr=input().split()
for i in range(0,n):
    arr[i]=int(arr[i])
m=max(arr[0:k])
for i in range(k-1,n):
    if(arr[i] > m):
        m=arr[i]
    if(arr[i-k]==m):
        m=max(arr[i-k+1:i+1])
    print (m, end=' '), In this Programming Language: Python, Now tell me if this Code is compilable or not?