Skip to content

Tag Archives: sliding-window

Given a large number as string s and an integer k which denotes the number of breakpoints we must put in the number k <=… Read More
Given an array of size n. The problem is to find the longest sub-array having exactly k odd numbers.Examples:   Input : arr[] = {2, 3,… Read More
You are given an array of n-elements and an odd-integer m. You have to construct a new sum_array from given array such that sum_array[i] =… Read More
You are given an array of n-elements you have to find the mean of the array as mean of all consecutive m-elements of array for… Read More
Given an array of N elements and L and R, print the number of sub-arrays such that the value of the maximum array element in… Read More
Given an array of integers and k, find the difference between the number of the strictly increasing number of subarrays (of size more than one)… Read More
Given an array and an integer K. We need to find the maximum of every segment of length K which has no duplicates in that… Read More
Given N elements and a number K, find the longest subarray which has not more than K distinct elements.(It can have less than K)Examples:   Input… Read More
We are given an array consisting of n integers and an integer k. We need to find the minimum range in array [l, r] (both… Read More
Given an array of n integers, for each element, print the distance to the closest zero. Array has a minimum of 1 zero in it.Examples:  … Read More
Given an array of positive numbers, calculate the number of possible contiguous subarrays having product lesser than a given number K. Examples :  Input :… Read More
Given an array of integer and two values k and i where k is the number of moves and i is the index in the… Read More
Given an array of integers, our goal is to find the length of the largest subarray having the sum of its elements at most ‘k’… Read More
Given a string of length N, find the length of the smallest sub-string consisting of maximum distinct characters. Note : Our output can have same… Read More
Given an array of non-negative integers and a sum. We have to find sum of the subarray having a maximum sum less than or equal… Read More