# Tag Archives: sliding-window

## Basic Algorithm Techniques Not Taught in Academics

We generally study most of the algorithmic techniques in academics like Searching, Sorting, Dynamic Programming, Greedy Algorithms, Divide and Conquer, Backtracking, etc. But below techniques… Read More »

## Shortest subarray to be removed to make all Array elements unique

Given an array arr[] containing N elements, the task is to remove a subarray of minimum possible length from the given array such that all… Read More »

## Find the subarray of size K with minimum XOR

Given an array arr[] and integer K, the task is to find the minimum bitwise XOR sum of any subarray of size K in the… Read More »

## Longest subarray in which absolute difference between any two element is not greater than X

Given an integer array arr[] of size N and an integer X, the task is to find the longest sub-array where the absolute difference between… Read More »

## Maximum count number of valley elements in a subarray of size K

Given an array arr[], the task is choose a subarray of size K which contains maximum number of valley points with respect to adjacent elements.… Read More »

## Maximize sum of K elements in Array by taking only corner elements

Given an array arr[] and an integer K, the task is to find the maximize the sum of K elements in the Array by taking… Read More »

## Find maximum Subsequence Sum according to given conditions

Given an integer array nums and an integer K, The task is to find the maximum sum of a non-empty subsequence of the array such… Read More »

## Remove k corner elements to maximize remaining sum

Given an array, the task is to remove total k elements from corners to maximize the sum of remaining elements. For example, if we k… Read More »

## Find subarray of Length K with Maximum Peak

Given an array arr[] of length n and a positive integer K, we have to find a subarray of length K which has maximum peak… Read More »

## Submatrix of given size with maximum 1’s

Given a binary matrix mat[][] and an integer K, the task is to find the submatrix of size K*K such that it contains maximum number… Read More »

## Sliding Window Maximum : Set 2

Set 1: Sliding Window Maximum (Maximum of all subarrays of size k). Given an array arr of size N and an integer K, the task… Read More »

## Sum of all subarrays of size K

Given an array arr[] and an integer K, the task is to calculate the sum of all subarrays of size K. Examples: Input: arr[] =… Read More »

## Median of sliding window in an array

Given an array of integer arr[] and an integer k, the task is to find the median of each window of size k starting from… Read More »

## Count of subarrays having exactly K distinct elements

Given an array arr[] of size N and an integer K. The task is to find the count of subarrays such that each subarray has… Read More »

## Find subarray with given sum with negatives allowed in constant space

Given an unsorted array of integers, find a subarray which adds to a given number. If there are more than one subarrays with the sum… Read More »