# Tag: Sliding Window

## Find count of distinct elements in every sub-array of size k

Given an array and an integer k, find the count of distinct elements in every sub-array of size k in the array.

## Print all sub-arrays of an array having distinct elements

Given an array of integers, print all maximum size sub-arrays having all distinct elements in them.

## Count the distinct absolute values in the sorted array

Given an array of sorted integers which may have several duplicates elements, count the number of distinct absolute values in the array.

## Find the length of smallest subarray whose sum of elements is greater than the given number

Given an array of integers, find the length of smallest subarray whose sum of elements is greater than the given positive number.

## Find subarray having given sum in given array of integers

Given an array of integers, find a subarray having given sum in it.

## Find minimum sum subarray of given size k

Given an array of integers, find minimum sum sub-array of given size k.

## Find the maximum sequence of continuous 1’s that can be formed by replacing at-most k zeroes by ones

Given an Boolean array, find the maximum sequence of continuous 1’s that can be formed by replacing at-most k zeroes by ones.

## Find index of 0 to be replaced to get maximum length sequence of continuous ones

Given a binary array, find the index of 0 to be replaced with 1 to get maximum length sequence of continuous ones.

## Longest substring of given string containing distinct characters

Given a string, find the longest substring of given string containing distinct characters.

## Find all substrings of a string that are permutation of a given string

Find all substrings of a string that contains all characters of another string. In other words, find all substrings of first string that are anagrams of second string.

## Find the longest substring of given string containing k distinct characters

Given a string and a positive number k, find the longest substring of given string containing k distinct characters. If k is more than number of distinct characters in the string, return the whole string.