Given a non-negative integer N, the task is to find the Nth row of Pascal’s Triangle. Note: The row index starts from 0. Pascal’s Triangle: 1 1… Read More

# Tag Archives: Permutation and Combination

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

Given an integer K and an array arr[], the task is to find the number of subsequences from the given array such that each subsequence… Read More

Given an array arr[] and an integer K, the task is to find number of non empty subsequence of length K from the given array… Read More

Given two positive integers N and K, the task is to count the number of ways to write N as a sum of K non-negative… Read More

Given N blocks out of which K are colored. These K colored blocks are denoted by an array arr[]. The task is to count the… Read More

Given two binary strings A and B of equal length N, the task is to find the number of distinct XORs possible by arbitrarily reordering… Read More

Given n and m, the task is to find the number of permutations of n distinct things taking them all at a time such that… Read More

There are N boys which are to be seated around a round table. The task is to find the number of ways in which N… Read More

Given an equilateral triangle made of dots (.) joined together to form triangle and an integer n which represents the length of the sides of… Read More

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

Given an array or string, the task is to find the next lexicographically greater permutation of it in Java. Examples: Input: string = "gfg" Output:… Read More

Given an array, the task is to print or display all the reverse permutations of this array using STL in C++. Reverse permutation means, for… Read More

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

Given an array, the task is to print or display all the permutations of this array using STL in C++. Examples: Input: a[] = {1,… Read More