Posted: 18 Nov, 2020
A permutation is a mathematical technique that determines the number of possible arrangements in a set when the order of the arrangements matters. A string of length 'N' has 'N'! permutations.
Given an array of distinct integers, return all the possible permutations of the array.
'ARR' = [1, 2] The size of the array is 2. So, the total number of permutations is 2! = 2. The possible permutations are [1, 2] (the array itself) and [2,1] where the position of element 1 in the original array is swapped with element 2 and vice-versa.
1. All the numbers in the array are unique. 2. You can return the answer in any order. 3. The original array is also a permutation of the given array.
The first line of input contains an integer ‘T’ denoting the number of test cases. The first line of each test case contains ‘N’ denoting the total number of elements in the array. The second line of each test case contains ‘N’ space-separated integers denoting the elements of the array 'ARR' whose all possible permutations are to be calculated.
For each test case, return all the possible permutations of the given array of integers.
You don't need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10 1 <= N <= 7 -10 ^ 9 <= ARR[i] <= 10 ^ 9 Where ‘ARR[i]’ denotes the range of elements in the array. Time limit: 1 sec
Best time to buy and sell stock
Posted: 2 Sep, 2022
Best time to buy and sell stock II
Posted: 5 Sep, 2022
Find Median from Data Stream
Posted: 9 Sep, 2022
Posted: 21 Oct, 2022
Find The Single Element
Posted: 30 Oct, 2022