Given an array arr[] of size N (1 ≤ N ≤ 105), the task is to find the number of ways to select a triplet… Read More

# Category Archives: Combinatorial

Given an array arr[] of size N, the task is to construct an array brr[] of size N that satisfies the following conditions: In every… Read More

Prerequisites: Z-algorithm Given a string S, the task is to find the maximum number of palindromes that can be formed after performing the given steps:… Read More

Given a binary string str, the task is to find the count of ways to partition the string such that each partitioned substring contains exactly… Read More

Given an array arr[] of size 26, representing frequencies of character ‘a’ to ‘z’, the task is to find the maximum number of palindromic strings… Read More

Given a numberic string N (1 ≤ |N| ≤ 105) and another numeric string S (1 ≤ |S| ≤ 105), the task is to find… Read More

Given two integers M and N, the task is to find the number of N-length arrays possible having non-equal adjacent elements lying in the range… Read More

Given a positive integer N, the task is to rearrange the digits of the given integer such that the integer becomes a power of 2.… Read More

Given three positive integers N, M and X, the task is to generate a number by appending X digits on the right side of N… Read More

Given a string str, consisting of three different types of characters ‘0’, ‘1’ and ‘?’, the task is to convert the given string to a… Read More

Given a binary string S of length N consisting of 0s, 1s, and “?”, where “?” can be replaced by either 0 or 1, the… Read More

Given an array arr[] of even length N and an integer K, the task is to minimize the count of replacing array elements by an… Read More

Given an array arr[] consisting of N characters, the task is to generate all possible combinations of at most X elements ( 1 ≤ X… Read More

Given an array arr[] of size N, the task is to find the count of all subsets from the given array whose product of is… Read More

Given an integer N, the task is to count the number of N-length strings consisting of lowercase vowels that can be generated based the following… Read More