Skip to content

Category Archives: Combinatorial

For N given cities, find how many ways a driver can traverse through them so that each town is visited exactly K times. From each… Read More
Given an array arr[] of N integers, the task is to find count of triplets having a product less than 0. Examples: Input: arr[] =… Read More
Given an array of pairs arr[] of size N (N ≥ 3) where each element of pair is at most N and each pair is… Read More
Given an array A[] of N  integers, the task is to calculate the total number of pairs of indices (i, j) satisfying the following conditions… Read More
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

Start Your Coding Journey Now!