Tag Archives: subset

Subset sum queries using bitset

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 given number exists in the array or not. Examples: Input : arr[] = {1, 2, 3}; query[] = {5, 3, 8} Output : Yes, Yes, No There is a subset… Read More »

Chocolate Distribution Problem

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 are m students, the task is to distribute chocolate packets such that : Each student gets one packet. The difference between the number of chocolates in packet with maximum chocolates… Read More »