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 »

Maximum number of Unique integers in Sub-Array of given size

Given an array of N integers and a number M. The task is to find out the maximum number of unique integers among all possible… Read More »

Print Minimum of all Subarrays using set in C++ STL

Given an array of size N and an integer K, find the minimum for each and every contiguous subarray of size K. Examples: Input :… Read More »

Sub-strings of length K containing same character

Given a string ‘str’ and an integer ‘k’, the task is to count the number of sub-strings of length ‘k’ which are comprised of the… Read More »

Subarray of size k with given sum

Given an array arr[], an integer K and a Sum. The task is to check if there exists any subarray with K elements whose sum… Read More »

Majority element in a circular array of 0’s and 1’s

Given a circular array containing only 0’s and 1’s, of size n where n = p*q (p and q are both odd integers). The task… Read More »

Lexicographically smallest and largest substring of size k

Given a String str and an integer k, find the lexicographically smallest and largest substring of length k Lexicography order, also called as alphabetical order… Read More »

Count Occurences of Anagrams

Given a word and a text, return the count of the occurences of anagrams of the word in the text(For eg: anagrams of word for… Read More »

Subarray whose absolute sum is closest to K

Given an array of n elements and an integer K, the task is to find the subarray with minimum value of ||a[i] + a[i +… Read More »

Number of subarrays having sum in a given range

Given an array arr[] of positive integers and a range (L, R). Find number of subarrays having sum in the range L to R. Examples:… Read More »

Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array | Set-2

Given an array of 0s and 1s, find the position of 0 to be replaced with 1 to get longest continuous sequence of 1s. Expected… Read More »