Skip to content

Category Archives: Combinatorial

Given an array arr[] of integers of size N that might contain duplicates, the task is to find all possible unique subsets, using C++ STL.… Read More
Given two integers N and X, the task is to convert 1 to N using minimum operations of any of the following operations: Change a… Read More
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 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

Start Your Coding Journey Now!