Function to sum of all subsets of a given array
function subsetSum ( c ) { var L = c . length ; var mul = parseInt ( Math . pow ( 2 , L - 1 ) ) ; for ( i = 0 ; i < c . length ; i ++ ) ans += c [ i ] * mul ; }