Given an N-ary tree rooted at 1, the task is to assign values from the range [0, N – 1] to each node in any order such that the sum of MEX values of each node in the tree is maximized and print the maximum possible sum of MEX values of each node in the tree....
Given an array arr[] consisting of N positive integers, the task is to generate all distinct subsequences of the array....
Given a list or array of integer, the task is to print all such subsequences of this list such in which the elements are arranged in increasing order.A Subsequence of the list is an ordered subset of that list’s element having same sequential ordering as the original list. Examples:...
Given a string str, the task is to print all the sub-sequences of str. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.Examples:...
Given an array arr[] consisting of N integers, the task is to find the sum of all subsets from an array, whose sum is a Perfect Number....
Given two numbers and N and D. Apply any of two below operations to N:...
In simple words, recursion is when a function is calling itself directly or indirectly....
Given an array A[] of n numbers and another number x, the task is to check whether or not there exist two elements in A[] whose sum is exactly x....
Given three arrays A[], B[] and C[] of size N and three positive integers X, Y, and Z, the task is to find the maximum sum possible by selecting at most N array elements such that at most X elements are from the array A[], at most Y elements from the array B[], at most Z elements are from the array C[] and all elements are from different indices....
Given two arrays arr1[] and arr2[] of length N and M respectively, the task is to find the length of the longest common prime subsequence that can be obtained from the two given arrays....
Given a binary tree and an integer K, the task is to print the paths from root to leaf with the maximum element greater than or equal to K. Print -1 if there exists no such path.Examples:...
Given two integers L and R, the task is to find the count of integers in the range [L, R] such that the frequency of each digit in the integer is even....