Find sum of all values
for ( let i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; } let val = Math . floor ( Math . sqrt ( sum ) ) ; for ( let i = val ; i >= 0 ; i -- ) { if ( isSubsetSum ( arr , n , i * i ) ) {