Function to find maximum equilibrium sum .
static int findMaxSum ( int [ ] arr , int n ) { int sum = arr . Aggregate ( func : Add ) ; int prefix_sum = 0 , res = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { prefix_sum += arr [ i ] ; if ( prefix_sum == sum ) res = Math . Max ( res , prefix_sum ) ; sum -= arr [ i ] ; } return res ; }