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