How to check whether an array is subset of another array using JavaScript ?
The task is to check whether an array is a subset of another array with the help of JavaScript. There are a few approaches, we will discuss below:...
read more
Javascript Program For Chocolate Distribution Problem
Given an array of n integers where each value represents the number of chocolates in a packet. Each packet can have a variable number of chocolates. There are m students, the task is to distribute chocolate packets such that:...
read more
Php Program For Chocolate Distribution Problem
Given an array of n integers where each value represents the number of chocolates in a packet. Each packet can have a variable number of chocolates. There are m students, the task is to distribute chocolate packets such that:...
read more
Subset Sum Problem
Given a set of non-negative integers and a value sum, the task is to check if there is a subset of the given set whose sum is equal to the given sum....
read more
Number of subsets with same AND, OR and XOR values in an Array
Given an array arr[] of size N consisting of non-negative integers, the task is to find the number of non-empty subsets of the array such that the bitwise AND, bitwise OR and bitwise XOR values of the subsequence are equal to each other....
read more
Count no. of ordered subsets having a particular XOR value
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 This is a modified version of this problem. So it is recommended to try that problem before.Examples:...
read more
Probability such that two subset contains same number of elements
Given a set containing N elements. If two subset X and Y picked then find the probability that both of them contains the same number of elements.Examples:...
read more
Maximum subset sum such that no two elements in set have same digit in them
Given an array of N elements. Find the subset of elements which has maximum sum such that no two elements in the subset has common digit present in them.Examples:...
read more
Minimize remaining array element by removing pairs and replacing them by their absolute difference
Given an array arr[] consisting of N positive integers, the task is to minimize the remaining array element that can be obtained by repeatedly removing a pair of array elements and replacing them by their absolute difference....
read more
Check whether bitwise AND of a number with any subset of an array is zero or not
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 of this subset with N is zero....
read more
Minimize sum of incompatibilities of K equal-length subsets made up of unique elements
Given an array arr[] consisting of N integers and an integer K, the task is to find the minimum sum of incompatibilities of K subsets of equal sizes having unique elements....
read more
Weird Number
In number theory, a weird number is a natural number that is abundant but not semiperfect. In other words, the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of those divisors sums to the number itself. Given a number N, the task is to check if the number is weird or not....
read more