Minimum substring removals required to make all remaining characters of a string same
Given a string str of length N, the task is to find the minimum number of substrings required to be removed to make all the remaining characters of the string same....
read more
Length of longest subsequence consisting of distinct adjacent elements
Given an array arr[], the task is to find the length of the longest subsequence of the array arr[] such that all adjacent elements in the subsequence are different....
read more
Queries to count characters having odd frequency in a range [L, R]
Given a string S of length N, consisting of lower case alphabets, and queries Q[][] of the form [L, R], the task is to count the number of characters appearing an odd number of times in the range [L, R]....
read more
Check if all possible Triplet Sum is present in given Array
Given an array arr[] of size N, the task is to check if for all distinct triplets of indices i, j, k, [  0 ≤ i < j < k ≤ N-1 ] the sum arr[i]+arr[j]+arr[k] is present in the array....
read more
Count ways to obtain triplets with positive product consisting of at most one negative element
Given an array arr[] of size N (1 ? N ? 105), the task is to find the number of ways to select triplet i, j, and k such that i < j < k and the product arr[i] * arr[j] * arr[k] is positive. Note: Each triplet can consist of at most one negative element....
read more
Count substrings consisting of equal number of a, b, c and d
Given a string str, the task is to count non-empty substrings with equal number of ‘a’, ‘b’, ‘c’, and ‘d’....
read more
Sum of Bitwise AND of each array element with the elements of another array
Given two arrays arr1[] of size M and arr2[] of size N, the task is to find the sum of bitwise AND of each element of arr1[] with the elements of the array arr2[]....
read more
Longest subarray of non-empty cells after removal of at most a single empty cell
Given a binary array arr[], the task is to find the longest subarray of non-empty cells after the removal of at most 1 empty cell....
read more
Count of ordered triplets with indices (i, j, k) representing distinct values and j – i != k – j
Given a ternary string S consisting of only three characters, the task is to find the count of ordered triplets (i, j, k) such that S[i], S[j] and S[k] are distinct and j – i != k – j....
read more
Count substrings having frequency of a character exceeding that of another character in a string
Given a string S of size N consisting of characters a, b, and c only, the task is to find the number of substrings of the given string S such that the frequency of character a is greater than the frequency of character c....
read more
Minimum deletions required such that any number X will occur exactly X times
Given an array arr[] of N integers, the task is to find the minimum deletions required such that frequency of arr[i] is exactly arr[i] in the array for all possible values of i.Examples:...
read more
Count strings from given array having all characters appearing in a given string
Given an array of strings arr[][] of size N and a string S, the task is to find the number of strings from the array having all its characters appearing in the string S....
read more