## Iterative approach to print all combinations of an Array

Given an array arr[] of size N, the task is to generate and print all possible combinations of R elements in array. Examples: Input: arr[]… Read More »

## Number of ways to arrange a word such that no vowels occur together

Given an English word of length at most 20 characters. Calculate the number of ways to arrange the word such that no vowels occur together.… Read More »

## Number of ways to paint a tree of N nodes with K distinct colors with given conditions

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… Read More »

## Find if nCr is divisible by the given prime

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:… Read More »

## Number of ways to reach the end of matrix with non-zero AND value

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 »

## Generate all permutations of a string that follow given constraints

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 »

## Generate an Array in which count of even and odd sum sub-arrays are E and O respectively

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 »

## Count number of subsets whose median is also present in the same subset

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 »

## Number of ways to arrange K different objects taking N objects at a time

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 »

## Product of all Subsequences of size K except the minimum and maximum Elements

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 »

## Count arrays of length K whose product of elements is same as that of given array

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 »

## Count different numbers possible using all the digits their frequency times

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 »

## Number of subsequences with zero sum

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,… Read More »

## 3-digit Osiris number

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 »

## Dudeney Numbers

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 »