# Category Archives: Combinatorial

## Count of K-size substrings having palindromic permutations

Given a string str consist of only lowercase alphabets and an integer K, the task is to count the number of substrings of size K… Read More »

## Count distinct median possible for an Array using given ranges of elements

Given an array of pairs arr[] which denotes the ranges of the elements of an array, the task is to count the distinct median of… Read More »

## Number of quadrilateral formed with N distinct points on circumference of Circle

Given an integer N which denotes the points on the circumference of a circle, the task is to find the number of quadrilaterals formed using… Read More »

## Count of common subarrays in two different permutations of 1 to N

Given two arrays A and B of the same length N, filled with a permutation of natural numbers from 1 to N, the task is… Read More »

## Check if an array can be formed by merging 2 non-empty permutations

Given an array arr[] of length N, the task is to check if it can be formed by merging two permutations of same or different… Read More »

## Print all permutations of a number N greater than itself

Given a number N, our task is to print those permutations of integer N which are greater than N. Examples: Input: N = 534 Output:… Read More »

## Count number of triangles possible for the given sides range

Given four integers A, B, C, and D, the task is to find the number of distinct sets (X, Y, and Z) where X, Y… Read More »

## Count numbers in a range with digit sum divisible by K having first and last digit different

Given a range in the form of L and R, and a value K, the task is to count the numbers between the range L… Read More »

## Total number Of valid Home delivery arrangements

Given number of orders, find the number of valid arrangements of orders where delivery of ith order is always after the pickup of ith order.Examples:… Read More »

## Sum of all subsequences of length K

Given an array arr[]and an integer K, the task is to find the sum of all K length subsequences from the given array. Example: Input:… Read More »

## Number of ways to paint K cells in 3 x N grid such that no P continuous columns are left unpainted

Given three integers N, P and K, the task is to find the number of ways of painting K cells of 3 x N grid… Read More »

## Probability of getting all possible values on throwing N dices

Given an integer N denoting the number of dices, the task is to find the probability of every possible value that can be obtained by… Read More »

## Count of integers up to N which represent a Binary number

Given an integer N, the task is to count every number i from 1 to N (both inclusive) such that i is a binary representation… Read More »

## Sort decreasing permutation of N using triple swaps

Given an array A[] consisting of decreasing permutation of N numbers, the task is to sort the array using triple swaps. If it is not… Read More »

## Number of ways to choose K intersecting line segments on X-axis

Given an array arr[] of line segments on the x-axis and an integer K, the task is to calculate the number of ways to choose… Read More »