Finding total number of multi-sets

248 Views Asked by At

I am provided with a multi-set, let's say S with elements as [num1, num2, num3] and these elements are integers (both negative as well as non negative). As this is a multi-set, elements in the multi-set can be present multiple times. I need to choose an element from this multi-set and multiply it with -1. I need to perform this operation m times. I want to find out how many multi-sets are there which can be made from this multi-set. This is home work, so really sorry but I am not able to proceed. I need some help in this. Please give me some hints. I am providing one example.

S = [2, 3, 2] and m=2 then there are 4 possible multisets

  1. [2, 3, 2]
  2. [-2, -3, 2]
  3. [-2, 3, -2]
  4. [2, -3, -2].

Any help would be appreciated.