## 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 all possible N digit numbers that satisfy the given condition

Given an integer N, the task is to count all possible N digit numbers such that A + reverse(A) = 10N – 1 where A… Read More »

## Maximum sub-array sum after dividing array into sub-arrays based on the given queries

Given an array arr[] and an integer k, we can cut this array at k different positions where k[] stores the positions of all the… Read More »

## Find sub-matrix with the given sum

Given an N x N matrix and two integers S and K, the task is to find whether there exists a K x K sub-matrix… Read More »

## Find the number of points that have atleast 1 point above, below, left or right of it

Given N points in 2 dimensional plane. A point is said to be above another point if the X coordinates of both points are same… Read More »

## Modify a binary array to Bitwise AND of all elements as 1

Given an array a[] consisting only 0 and 1. The task is to check if it is possible to transform the array such that the… Read More »

## Python program to get all subsets of given size of a set

Given a set, write a Python program to generate all possible subset of size n of given set within a list. Examples: Input : {1,… Read More »

## Sum of minimum elements of all possible sub-arrays of an array

Given an array arr[], the task is to find the sum of the minimum elements of every possible sub-array of the array. Examples: Input: arr[]… Read More »

## Sum of maximum elements of all possible sub-arrays of an array

Given an array arr[], the task is to find the sum of the maximum elements of every possible sub-array of the array. Examples: Input: arr[]… Read More »

## Count the number of rhombi possible inside a rectangle of given size

Given a rectangle of height H and width W which has the bottom left corner at (0, 0). The task is to count the number… Read More »

## Maximize the sum of products of the degrees between any two vertices of the tree

Given an integer N, the task is to construct a tree such that sum of for all ordered pairs (u, v) is maximum where u… Read More »

## Count the total number of squares that can be visited by Bishop in one move

Given the position of a Bishop on an 8 * 8 chessboard, the task is to count the total number of squares that can be… Read More »

## Java Program to print distinct permutations of a string

Given a string str, the task is to print all the distinct permutations of str. A permutation is an arrangement of all or part of… Read More »

## An application on Bertrand’s ballot theorem

Given the number of ‘X’ and ‘Y’ in a string which consists of characters from the set {‘X’, ‘Y’}, the task is to find the… Read More »

## Minimum number of integers required to fill the NxM grid

Given a grid of size (NxM) is to be filled with integers. Filling of cells in the grid should be done in the following manner:… Read More »