Return Subsets Sum to K
Posted: 24 Sep, 2020
Given an integer array 'ARR' of size 'N' and an integer 'K', return all the subsets of 'ARR' which sum to 'K'.
Subset of an array 'ARR' is a tuple that can be obtained from 'ARR' by removing some (possibly all) elements of 'ARR'.
The order of subsets is not important. The order of elements in a particular subset should be in increasing order of the index.
The first line of input contains an integer 'N', which denotes the size of the array. The second line contains 'N' single-space separated integers representing the elements of the array. The third line contains a single integer 'K', which denotes the integer to which the subsets should sum to.
For each test case, print single-space separated integers of a subset of 'ARR' having sum = 'K'. The output of each test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= 'N' <= 16 - (10 ^ 6) <= ARR[i] <= (10 ^ 6) - 16 * (10 ^ 6) <= 'K' <= 16 * (10 ^ 6) Where ‘ARR[i]’ denotes the value for ‘ith’ element of the array ‘ARR’ and 'K' is the given sum. Time Limit: 1 sec.
Best time to buy and sell stock
Posted: 2 Sep, 2022
Best time to buy and sell stock II
Posted: 5 Sep, 2022
Ninja And The Class Room
Posted: 19 Sep, 2022
Posted: 21 Oct, 2022
Find The Single Element
Posted: 30 Oct, 2022