## Number of subarrays having product less than K

Given an Array of positive numbers, calculate the number of possible subarrays having product greater than a given number K. Examples : Input : arr[]… Read More »

## Collect maximum points in an array with k moves

Given an array of integer and two value k and i where k is number of moves and i is index in array. Task is… Read More »

## Longest Subarray having sum of elements atmost ‘k’

Given an array of integers, our goal is to find the length of largest subarray having sum of its elements atmost ‘k’ where k>0. Examples:… Read More »

## Length of the smallest sub-string consisting of maximum distinct characters

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 »

## Maximum sum subarray having sum less than or equal to given sum

Given an array of integers and a sum. We have to find sum of subarray having maximum sum less than or equal to given sum… Read More »

## Convert all substrings of length ‘k’ from base ‘b’ to decimal

A string defining a valid number is given. Output all the base conversions of substrings of length ‘k’ from base ‘b’ to base 10. Examples:… Read More »

## Sum of product of all elements of sub-arrays of size k

Given an array and a number k, the task is to calculate the sum of the product of all elements of subarrays of size k.… Read More »

## Count subarrays having total distinct elements same as original array

Given an array of n integers. Count total number of sub-array having total distinct elements same as that of total distinct elements of original array.… Read More »

## First negative integer in every window of size k

Given an array and a positive integer k, find the first negative integer for each and every window(contiguous subarray) of size k. If a window… Read More »

## Largest sum subarray with at-least k numbers

Given an array, find the subarray (containing at least k numbers) which has the largest sum. Examples: Input : arr[] = {-4, -2, 1, -3}… Read More »

## Smallest window that contains all characters of string itself

Given a string, find the smallest window length with all distinct characters of the given string. For eg. str = “aabcbcdbca”, then the result would… Read More »

## Window Sliding Technique

This technique shows how a nested for loop in few problems can be converted to single for loop and hence reducing the time complexity. Let’s… Read More »

## Find maximum (or minimum) sum of a subarray of size k

Given an array of integers and a number k, find maximum sum of a subarray of size k. Examples : Input : arr[] = {100,… Read More »

## Sum of minimum and maximum elements of all subarrays of size k.

Given an array of both positive and negative integers, the task is to compute sum of minimum and maximum elements of all sub-array of size… Read More »

## Find maximum of minimum for every window size in a given array

Given an integer array of size n, find the maximum of the minimum’s of every window size in the array. Note that window size varies… Read More »