# Category Archives: Combinatorial

Given a binary array arr[] of size N, the task is to find the count of distinct alternating triplets. Note: A triplet is alternating if… Read More
Given a binary string s of length N, the task is to find the lexicographically smallest string using infinite number of swaps between 0’s and… Read More
Given two integers N, Y, generate a permutation of length N such that sum of all prefix minimum of that permutation is Y. Example:  Input:… Read More
Given two integers, N and K, the task is to find the number of permutations of numbers from 0 to N – 1, such that… Read More
Given two integers N and K, the task is to check if it is possible to form a permutation of N integers such that it… Read More
Given an A “1″s, B “10”s, and C “0”s, the task is to count of sum of “10” subsequences for each 1s in the string… Read More
Given a matrix of size N x M initially filled with 1, the task is to find the number of ways to make the sum… Read More
Given an array nums[ ] and an integer target. Find whether there exists a combination of integers in nums[ ] such that their sum is… Read More
Given a 2D array A[][] of size N x 2 where: Every element lies between [1, N]. A[i][0] signifies that there must be at most… Read More
Given two integers M and N, the task is to generate an MxN matrix having elements in range [1, MxN] such that the average of… Read More
Given a number N, the task is to represent N as sum of maximum number of unique positive integers. Examples:  Input: N = 12Output: 1+… Read More
Given three integers X, Y and Z denoting the frequencies of three different characters ‘0‘, ‘1‘, and ‘2’ respectively. the task is to find the… Read More
Given four arrays A[], B[], C[], D[] and an integer K. The task is to find the number of combinations of four unique indices p,… Read More
In the COVID times, a movie theatre has to follow a Social distance rule where every two seated individuals must have at least 6 feet… Read More
Given an integer N(positive or negative), the task is to find the maximum number that can be formed using all of the digits of this… Read More