diff --git a/src/com/interview/array/SlidingWindow.java b/src/com/interview/array/SlidingWindow.java new file mode 100644 index 00000000..02254aa3 --- /dev/null +++ b/src/com/interview/array/SlidingWindow.java @@ -0,0 +1,61 @@ +package Interviewquestions; +import java.util.Deque; +import java.util.LinkedList; +public class Slidingwindow { + + + + + + + + + public static void main(String[] args) { + Solution solution= new Solution(); + int a[]= {4,3,1,2,5,3,4,7,1,9}; + int ans[]= solution.maxSlidingWindow(a, 4); + + for(int x:ans) { + System.out.print(x+" "); + } + } + static class Solution { + public int[] maxSlidingWindow(int[] a, int k) { + int n= a.length; + Dequedq=new LinkedList<>(); + int ans[]=new int[n-k+1]; + + + int i=0; + for(;i