## Print all the permutation of length L using the elements of an array | Iterative

Given an array of unique elements, we have to find all the permutation of length L using the elements of the array. Repetition of elements… Read More »

## Iterative program to generate distinct Permutations of a String

Given a string str, the task is to generate all the distinct permutations of the given string iteratively. Examples: Input: str = “bba” Output: abb… Read More »

## Largest substring with same Characters

Given a string s of size N. The task is to find the largest substring which consists of same characters Examples: Input : s =… Read More »

## Find the number of words of X vowels and Y consonants that can be formed from M vowels and N consonants

Given four integers X, Y, M and N. The task is to find the number of ways to form a word by choosing X number… Read More »

## Number of ways to arrange 2*N persons on the two sides of a table with X and Y persons on opposite sides

Given three integers N, X and Y. The task is to find the number of ways to arrange 2*N persons along two sides of a… Read More »

## Sum of the distances from every node to all other nodes is maximum

Given a tree with N nodes and N-1 edges with root at 1 and given an array of N-1 integers. The task is to assign… Read More »

## Count ways to divide circle using N non-intersecting chord | Set-2

Given a number N. The task is to find the number of ways you can draw N chords in a circle with 2*N points such… Read More »

## Probability of distributing M items among X bags such that first bag contains N items

Given three integers N, M, X. The task is to find the probability of distributing M items among X bags such that first bag contains… Read More »

## Number of N length sequences whose product is M

Given two integers N and M, the task is to find the count of possible sequences a1, a2, … of length N such that the… Read More »

## Number of Quadruples with GCD equal to K

Given two integers N and K, the task is to find the count of quadruples of (i, j, k, l) such that 1 ≤ i… Read More »

## Total ways of choosing X men and Y women from a total of M men and W women

Given four integers X, Y, M and W. The task is to find the number of ways to choose X men and Y women from… Read More »

## Mobile Numeric Keypad Problem | Set 2

Given the mobile numeric keypad. You can only press buttons that are up, left, right or down to the current button or can choose to… Read More »

## Partition first N natural number into two sets such that their sum is not coprime

Given an integer N, the task is to partition the first N natural numbers in two non-empty sets such that the sum of these set… Read More »

## Probability of getting more heads than tails when N biased coins are tossed

Given an array p[] of odd length N where p[i] denotes the probability of getting a head on the ith coin. As the coins are… Read More »

## Iterative approach to print all permutations of an Array

Given an array arr[] of size N, the task is to generate and print all permutations of the given array. Examples: Input: arr[] = {1,… Read More »