Given two integers S and D, the task is to check if the integer S can be made divisible by D or not by repeatedly… Read More

# Tag Archives: Pigeonhole Principle

Given an array arr[] consisting of N integers such that arr[i] representing the number of socks of the color i and an integer K, the… Read More

One day Ram and Shyam were searching Google for finding what is the maximum number of hairs on the human head. They found that it… Read More

Given an array of N integers, the task is to find a non-empty subset such that the sum of elements of the subset is divisible… Read More

Given an array, find the maximum difference between its two consecutive elements in its sorted form.Examples: Input: arr[] = {1, 10, 5} Output: 5 Sorted… Read More

Given an array A[], find a subset of maximum size in which sum of every pair of elements is a prime number. Print its length… Read More

Prerequisite – The Pigeonhole Principle Problem statement – Given a 8×8 chessboard, figure out the maximum number of kings that can be placed on the… Read More

Combinatorics is the branch of Mathematics dealing with the study of finite or countable discrete structures. It includes the enumeration or counting of objects having… Read More

Also known as Gravity sort, this algorithm was inspired from natural phenomenons and was designed keeping in mind objects(or beads) falling under the influence of… Read More

Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes to roost. Because there are 20 pigeons but only 19 pigeonholes,… Read More

Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key… Read More