Category Archives: Combinatorial

Given a tree with N nodes and a number K. Paint every node of the tree in one of the K available colors. Count and return… Read More
Given three integers N, R and P where P is prime, the task is to find whether NCR is divisible by P or not.Examples:   Input:… Read More
Given an N * N matrix arr[][] consisting of non-negative integers, the task is to find the number of ways to reach arr[N – 1][N… Read More
Given a string, generate all permutations of it that do not contain ‘B’ after ‘A’, i.e., the string should not contain “AB” as a substring.… Read More
Given three integers N, E and O. The task is to find an array of size N such that the number of sub-arrays of sum… Read More
Given an array arr[] of size N, the task is to count the number of ways we can select a subset from the given array… Read More
Given two integers K and N, the task is to count the number of ways to arrange K different objects taking N objects at a… Read More
Given an array A[] containing N elements and an integer K. The task is to calculate the product of all elements of subsequences of size… Read More
Given an integer array arr[] of length N and an integer K, the task is to count the number of possible arrays of length K… Read More
Given an array arr[] which contains the frequency of the digits (0-9), the task is to find the count of numbers possible using each digit… Read More
Given an array arr[] of N integers. The task is to count the number of sub-sequences whose sum is 0. Examples:   Input: arr[] = {-1, 2,… Read More
Given a 3-digit number N, the task is to find if N is an Osiris number or not. Osiris numbers are the numbers that are… Read More
Given an integer n, the task is to check if n is a Dudeney number or not. A Dudeney number is a positive integer that… Read More
Given an integer N, the task is to check if N is a Dihedral prime number or not. A Dihedral prime is a prime number… Read More
Given an array of N integers where arr[i] denotes the number of sticks of length 2i. The task is to find the number of triangles… Read More