prob:
https://hack.codingblocks.com/app/contests/2022/250/problem 2
hello @raghav007
u have misunderstood the question ( u r always considering subarray but subset[need not to be contiguous] can also form a group).
the idea is ->
a) compute total sum of array .
b) then find how many subset are there with sum = total sum/2
to generate subset u can use inclusion exclusion logic .
aren’t subsets part of the subarray I’m a bit confused here. We haven’t been taught inclusion exclusion principle is there any other brute force way
I remember now that subarray is contiguous
no , subset can be subarray but not all subarray are subset.
example->
[1,2,3]
here -> {1,3} is subset but not subarray.
Do i need to generate the powerset and see which subsets have the same value?
yeah u need to generate all power set and then see which of them have sum=total sum/2 .
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.