## Number of words that can be made using exactly P consonants and Q vowels from the given string

Given a string str and two integers P and Q. The task is to find the total count of words that can be formed by… Read More »

## Number of ways of choosing K equal substrings of any length for every query

Given a string str and Q queries. Each query consists of an integer K. The task is to find the number of ways of choosing… Read More »

## Number of ways to go from one point to another in a grid

Given the NxN grid of horizontal and vertical roads. The task is to find out the number of ways that the person can go from… Read More »

## Ways to Remove Edges from a Complete Graph to make Odd Edges

Given a complete graph with N vertices, the task is to count the number of ways to remove edges such that the resulting graph has… Read More »

## Calculate nCr using Pascal’s Triangle

A useful application of Pascal’s triangle is the calculation of combinations. The formula to find nCr is n! / r! * (n – r)! which… Read More »

## Count the number of special permutations

Given two positive integers n and k, the task is to count the number of special permutations. A special permutation P is defined as a… Read More »

## Ways of selecting men and women from a group to make a team

Given four integers n, w, m and k where, m is the total number of men. w is the total number of women. n is… Read More »

## Ways of dividing a group into two halves such that two elements are in different groups

Given 2n girls and randomly divided into two subgroups each containing n girls. The task is to count the number of ways in which groups… Read More »

## Program to find the value of sin(nΘ)

Given the value of sin(Θ) and a variable n<=15. The task is to find the value of sin(nΘ) using propety of trignometric functions. Examples: Input:… Read More »

## Program to find the value of tan(nΘ)

Given a value of tan(Θ) and a variable n <=15. The task is to find the value of tan(nΘ) using property of trignometric functions. Examples:… Read More »

## Program to Find the value of cos(nΘ)

Given a value of cos(Θ) and a variable . The task is to find the value of cos(nΘ) using propety of trignomertric functions. Note: n… Read More »

## Eggs dropping puzzle (Binomial Coefficient and Binary Search Solution)

Given n eggs and k floors, find the minimum number of trials needed in worst case to find the floor below which all floors are… Read More »

## Queries of nCr%p in O(1) time complexity

Given Q queries and P where P is a prime number, each query has two numbers N and R and the task is to calculate… Read More »

## beta(), betaf() and betal() functions in C++ STL

The beta(), betaf() and betal() are built-in functions in C++ STL that are used to compute the beta functionof two positive real values. The function… Read More »

## Sum of product of consecutive Binomial Coefficients

Given a positive ineteger n. The task is to find the sum of product of consecutive binomial coefficient i.e nC0*nC1 + nC1*nC2 + ….. +… Read More »