This function mainly calls recursive function distSumRec ( ) to generate distinct sum subsets . And finally prints the generated subsets .
function printDistSum ( arr , n ) { let s = new Set ( ) ; distSumRec ( arr , n , 0 , 0 , s ) ; let s1 = [ ... s ] s1 . sort ( function ( a , b ) { return a - b ; } )