Reversing the array to use the same existing function for operations of the second type
int [ ] reverse_arr = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) reverse_arr [ size - 1 - i ] = arr [ i ] ; resSum = Math . Max ( resSum , maxSumSubWithOp ( reverse_arr ) ) ; return resSum ; }