## Sum of (maximum element – minimum element) for all the subsets of an array.

Given an array arr[], the task is to compute the sum of (max{A} – min{A}) for every non-empty subset A of the array arr[]. Examples:… Read More »

- Recursive program to print all subsets with given sum
- Printing all subsets of {1,2,3,...n} without using array or loop
- Count of sub-sets of size n with total element sum divisible by 3
- Split the array into equal sum parts according to given conditions
- Sum of (maximum element - minimum element) for all the subsets of an array.
- Total number of subsets in which the product of the elements is even
- Subset Sum Queries in a Range using Bitset
- Maximize the difference between two subsets of a set with negatives
- Check if it is possible to get back to 12'0 clock only by adding or subtracting given seconds
- Count sub-sets that satisfy the given condition
- Count no. of ordered subsets having a particular XOR value
- Find if there is any subset of size K with 0 sum in an array of -1 and +1
- Largest subset where absolute difference of any two element is a power of 2

Given an array arr[], the task is to compute the sum of (max{A} – min{A}) for every non-empty subset A of the array arr[]. Examples:… Read More »

Given an integer array arr[], the task is to check if the input array can be split in two sub-arrays such that: Sum of both… Read More »

Given an integer n and a range [l, r], the task is to find the count of total sub-sets of size n with integers from… Read More »

Given an array arr[] of n elements and a number K, find the number of ordered subsets of arr[] having XOR of elements as K… Read More »

Given N seconds. The task is to check if it is possible to start from 12’0 clock and get back to 12 only adding or… Read More »

Given an array arr[] of distinct elements -109 ≤ ai ≤ 109. The task is to find the largest sub-set from the given array such… Read More »

Given an array and a number, print all subsets with sum equal to given the sum. Examples: Input : arr[] = {2, 5, 8, 4,… Read More »

Given an array arr[] and an integer x, the task is to count the number of sub-sets of arr[] sum of all of whose sub-sets… Read More »

Given an of integers of size N. The task is to separate these integers into two groups g1 and g2 such that (sum of elements… Read More »

Given an array[] of N positive integers and M queries. Each query consists of two integers L and R represented by a range. For each… Read More »

Given an integer K and an array arr containing only 1 and -1, the task is to find if there is any subset of size… Read More »

Given an array arr[] of integer elements, the task is to find the total number of sub-sets of arr[] in which product of the elements… Read More »

Given a natural number n, print all the subsets of the set without using any array or loop (only the use of recursion is allowed).… Read More »

Given an array of size N and a sum, the task is to check whether some array elements can be added to sum to N… Read More »

Given an array and a Number N. The task is to check whether there exists any subset of this array such that the bitwise AND… Read More »