Sum of minimum element of all sub | Function to find the sum of minimum of all subsequence ; Driver code
function findMinSum ( arr , n ) { var occ = n - 1 , sum = 0 ; for ( var i = 0 ; i < n ; i ++ ) { sum += arr [ i ] * Math . pow ( 2 , occ ) ; occ -- ; } return sum ; } var arr = [ 1 , 2 , 4 , 5 ] ; var n = arr . length ; document . write ( findMinSum ( arr , n ) ) ;