sum denotes the current sum of the subset currindex denotes the index we have reached in the given array
function distSumRec ( arr , n , sum , currindex , s ) { if ( currindex > n ) return ; if ( currindex == n ) { s . add ( sum ) ; return ; } distSumRec ( arr , n , sum + arr [ currindex ] , currindex + 1 , s ) ; distSumRec ( arr , n , sum , currindex + 1 , s ) ; }