## 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 »

## Minimum increment operations to make K elements equal

Given an array arr[] of N elements and an integer K, the task is to make any K elements of the array equal by performing… Read More »

## Maximum sum of K consecutive nodes in the given Linked List

Given a linked list, the task is tofind the maximum sum obtained by adding any k consecutive nodes of linked list. Examples: Input: 1 ->… Read More »

## Count of substrings which contains a given character K times

Given a string consisting of numerical alphabets, a character C and an integer K, the task is to find the number of possible substrings which… Read More »

## Number of sub-strings that contain the given character exactly k times

Given a string str, a character c and an integer k > 0. The task is to find the number of sub-strings that contain the… Read More »

## Minimum cost to modify a string

Given a string str consisting of lower case alphabets only and an integer K. The task is to find the minimum cost to modify the… Read More »

## Minimum number of elements to be removed such that the sum of the remaining elements is equal to k

Given an array arr[] of integers and an integer k, the task is to find the minimum number of integers that need to be removed… Read More »

## Minimum length substring with exactly K distinct characters

Given a string S and a number K. The task is to find the minimum length substring having exactly K distinct characters. Note: The string… Read More »

## Maximum of all Subarrays of size k using set in C++ STL

Given an array of size N and an integer K, the task is to find the maximum for each and every contiguous sub-array of size… Read More »

## Number of sub-strings which are anagram of any sub-string of another string

Given two strings S1 and S2, the task is to count the number of sub-strings of S1 that are anagrams of any sub-string of S2.… Read More »

## Find number of substrings of length k whose sum of ASCII value of characters is divisible by k

Given a string and a number k, the task is to find the number of substrings of length k whose sum of ASCII value of… Read More »

## Maximum sum and product of the M consecutive digits in a number

Given a number in the form of a string. The task is to find the maximum sum and product of m consecutive digits that are… Read More »

## Number of sub-arrays that have at least one duplicate

Given an array arr of n elements, the task is to find the number of the sub-arrays of the given array that contain at least… Read More »