Sorting Vector of Arrays in C++ Given a vector of arrays, the task is to sort them. Examples: Input: [[1, 2, 3], [10, 20, 30], [30, 60, 90], [10, 20, 10]] Output: [[1, 2, 3], [10, 20, 10], [10, 20, 30], [30, 60, 90]] Input: [[7, 2, 9], [5, 20, 11], [6, 16, 19]] Output: [[5, 20, 11], [6, 16, 19], [7, 2, 9]] Approach: To sort the Ve
2 min read
Generate all possible permutations of a Number divisible by N Given a numerical string S, the task is to print all the permutations of the string which are divisible by N. Examples: Input: N = 5, S = "125" Output: 125 215Explanation: All possible permutations are S are {125, 152, 215, 251, 521, 512}. Out of these 6 permutations, only 2 {125, 215} are divisible
5 min read
Count of distinct permutations of every possible length of given string Given a string S, the task is to count the distinct permutations of every possible length of the given string. Note: Repetition of characters is not allowed in the string. Input: S = âabcâOutput: 15Explanation:Possible Permutations of every length are:{âaâ, âbâ, âcâ, âabâ, âbcâ, âacâ, âbaâ, âcaâ, âc
5 min read