title: Finding all possible subset sum which is equal to 0 out of set of positive and negative numbers?
body: <p>You have an array which has a set of positive and negative numbers, print all the subset sum which is equal to 0.</p>
  
  <p>I can think of approach where i can cam make all powersets of givcen array and check if their sum is 0. BUt that does not llok like optimized solution to
  me.</p>
  
  <p>After reading looks a bit similar problem on net , looks like it can be solved with dynamic programming like below program to find if there is combination exist
  to make sum 11 just an example ?</p>
  
  <pre><code>public boolean subsetSum(int input[], int total) {
  
          boolean T[][] = new boolean[input.length + 1][total + 1];
          for (int i = 0; i &lt;= input.length; i++) {
              T[i][0] = true;
          }
  
          for (int i = 1; i &lt;= input.length; i++) {
              for (int j = 1; j &lt;= total; j++) {
                  if (j - input[i - 1] &gt;= 0) {
                      T[i][j] = T[i - 1][j] || T[i - 1][j - input[i - 1]];
                  } else {
                      T[i][j] = T[i-1][j];
                  }
              }
          }
          return T[input.length][total];
  
      }
  
  
  
  
  public static void main(String args[]) {
      TestDynamic ss = new TestDynamic();
     int arr1[] = {2, 3, 7, 8};
      System.out.print(ss.subsetSum(arr1, 11));
  
  }
  </code></pre>
  
  <p>But i am not sure how to extend above programe to </p>
  
  <p>1) Include negative number<br>
  2) find combination of elements  whick makes sum as zero( Above program just finds whether its possible to make given sum but does not
  find which set of numbers makes it zero)</p>