# Category Archives: Combinatorial

Find the number of permutations of first N positive integers such that the sum of any two consecutive numbers is prime where all the cyclic… Read More
Given an integer N, the task is to print all the unique combinations of putting N pieces in an NxN board. Note: Print (“*”) for… Read More
Given a positive integer N, the task is to print all possible sum of perfect squares such that the total sum of all perfect squares… Read More
Given string str of length N, the task is to print the number of substrings in which every character’s ASCII value is greater or equal… Read More
Given an array vec[] of size N of non-negative integers. The task is to count the number of subsequences with the sum equal to S… Read More
Given two flavors of ice-cream chocolate and vanilla denoted by 0 and 1 respectively. People are standing in queue to get their desired flavor of… Read More
A permutation also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with… Read More
Graph colouring is the task of assigning colours to the vertices of a graph so that: pairs of adjacent vertices are assigned different colours, and… Read More
Given string str containing characters ‘?’, ‘(‘ and ‘)’, the task is to replace the ‘?’ character with ‘(‘ or ‘)’ and print all the… Read More
Given three integers a, b and c which denotes the frequencies of three different characters ‘A‘, ‘B‘, and ‘C‘ respectively, and can be used to… Read More
Given two arrays arr1[] and arr2[] with distinct elements of size N.The task is to count the total number of possible combinations after swapping elements… Read More
Given two integers N and K, the task is to find the count of binary strings of at most N length that can be formed… Read More
Given two integers A and B, the task is to convert the given two integers to zero at minimal cost by performing the following two… Read More
Given a numeric string S of size N, the task is to find the number formed by adding numbers 1, 2, 3, … up to… Read More
Given a positive integer N, the task is to find the minimum number of addition operations required to convert the number 0 to N such… Read More