Total length of string from given Array of strings composed using given characters
Given a list of characters and an array of strings, find the total length of all strings in the array of strings that can be composed using the given characters.Examples:...
read more
Count permutations possible by replacing ‘?’ characters in a Binary String
Given a string S consisting of characters 0, 1, and ‘?’, the task is to count all possible combinations of the binary string formed by replacing ‘?’ by 0 or 1....
read more
Remove elements from the array which appear more than k times
Given an array of integers, remove all the occurrences of those elements which appear strictly more than k times in the array.Examples:...
read more
Find given occurrences of Mth most frequent element of Array
Given an array arr[], integer M and an array query[] containing Q queries, the task is to find the query[i]th occurrence of Mth most frequent element of the array....
read more
Smallest number to be added in first Array modulo M to make frequencies of both Arrays equal
Given two arrays A[] and B[] consisting of N positive integers and an integer M, the task is to find the minimum value of X such that operation (A[i] + X) % M performed on every element of array A[] results in the formation of an array with frequency of elements same as that in another given array B[]....
read more
Length of the longest substring that contains even number of vowels
Given a string S consisting of N lowercase characters, the task is to find the length of the longest substring consisting of each vowel an even number of times...
read more
Count all possible pairs in given Array with product K
Given an integer array arr[] of size N and a positive integer K, the task is to count all the pairs in the array with a product equal to K....
read more
Count pairs in an array having sum of elements with their respective sum of digits equal
Given an array arr[] consisting of N positive integers, the task is to count the number of pairs in the array, say (a, b) such that sum of a with its sum of digits is equal to sum of b with its sum of digits....
read more
Minimize increments required to make count of even and odd array elements equal
Given an array arr[] of size N, the task is to find the minimum increments by 1 required to be performed on the array elements such that the count of even and odd integers in the given array becomes equal. If it is not possible, then print “-1”....
read more
Count minimum substring removals required to reduce string to a single distinct character
Given a string S consisting of ‘X’, ‘Y’ and ‘Z’ only, the task is to convert S to a string consisting of only a single distinct character by selecting a character and removing substrings that does not contain that character, minimum number of times....
read more
Number of quadruples where the first three terms are in AP and last three terms are in GP
Given an array arr[] of N integers. The task is to find the number of index quadruples (i, j, k, l) such that a[i], a[j] and a[k] are in AP and a[j], a[k] and a[l] are in GP. All the quadruples have to be distinct.Examples:...
read more
Sum of elements in an array having prime frequency
Given an array arr, the task is to find the sum of the elements which have prime frequencies in the array. Note: 1 is neither prime nor composite.Examples:...
read more