# Tag Archives: subset

## k size subsets with maximum difference d between max and minOctober 16, 2017

Given an array and two integers k and d, find the number of subsets of this array of size k, where difference between the maximum… Read More »

## Sum of all subsets of a set formed by first n natural numbersOctober 7, 2017

Given a number n, we need to find the sum of all the elements from all possible subsets of a set formed by first n… Read More »

## Count subsets having distinct even numbersMay 23, 2017

Given a set of n numbers. The task is to count all the subsets of the given set which only have even numbers and all… Read More »

## Largest subset whose all elements are Fibonacci numbersMay 21, 2017

Given an array with positive number the task is that we find largest subset from array that contain elements which are Fibonacci numbers. Asked in… Read More »

## Subset with sum divisible by mApril 16, 2017

Given a set of non-negative distinct integers, and a value m, determine if there is a subset of the given set with sum divisible by… Read More »

## Perfect Sum Problem (Print all subsets with given sum)April 15, 2017

Given an array of integers and a sum, the task is to print all subsets of given array with sum equal to given sum. Examples:… Read More »

## Minimum difference between max and min of all K-size subsetsMarch 24, 2017

Given an array of integer values, we need to find the minimum difference between maximum and minimum of all possible K-length subsets. Examples: Input :… Read More »

## Largest divisible subset in arrayMarch 17, 2017

Given an array the task is to largest divisible subset in array. A subset is called divisible if for every pair (x, y) in subset,… Read More »

## Find all distinct subset (or subsequence) sums of an arrayJanuary 10, 2017

Given a set of integers, find distinct sum that can be generated from the subsets of the given sets and print them in an increasing… Read More »

## Subset sum queries using bitsetJanuary 4, 2017

Given an array arr[] and a number of queries, where in each query we have to check whether a subset whose sum is equal to… Read More »

## Chocolate Distribution ProblemJanuary 2, 2017

Given an array of n integers where each value represents number of chocolates in a packet. Each packet can have variable number of chocolates. There… Read More »

## Count minimum number of subsets (or subsequences) with consecutive numbersDecember 19, 2016

Given an array of distinct positive numbers, the task is to calculate the number of subsets (or subsequences) from the array such that each subset… Read More »

## Count number of subsets having a particular XOR valueFebruary 8, 2016

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

## Bell Numbers (Number of ways to Partition a Set)November 6, 2015

Given a set of n elements, find number of ways of partitioning it. Examples: Input: n = 2 Output: Number of ways = 2 Explanation:… Read More »