text: Function to calculate the sum from 0 th position to ( n - 2 ) th position
code: static int maxSum1 ( int [ ] arr , int n ) { int [ ] dp = new int [ n ] ; int maxi = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) {