Sum of minimum element of all sub | C # implementation of the above approach ; Function to find the sum of minimum of all subsequence ; Driver code
using System ; class GFG { static int findMinSum ( int [ ] arr , int n ) { int occ = n - 1 , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] * ( int ) Math . Pow ( 2 , occ ) ; occ -- ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 5 } ; int n = arr . Length ; Console . WriteLine ( findMinSum ( arr , n ) ) ; } }