sum denotes the current sum of the subset currindex denotes the index we have reached in the given array
static void distSumRec ( int [ ] arr , int n , int sum , int currindex , HashSet < int > 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 ) ; }