20. Dynamic Programming/LargestSumSubarray.cpp
int maxSubArraySum(vector<int>arr, int n)
{
    int max_so_far = INT_MIN, max_ending_here = 0;
    for (int i = 0; i < n; i++)
    {
        max_ending_here = max_ending_here + arr[i];
        max_so_far = max(max_so_far,max_ending_here);
        if (max_ending_here < 0)
        {
            max_ending_here = 0;
        }
    }
    return max_so_far;
}
// Function to calculate Largest Sum Subarray
Function to calculate Largest Sum Subarray
Function to calculate Largest Sum Subarray
int maxSubArraySum(vector<int>arr, int n)
{
    int max_so_far = INT_MIN, max_ending_here = 0;
    for (int i = 0; i < n; i++)
    {
        max_ending_here = max_ending_here + arr[i];
        max_so_far = max(max_so_far,max_ending_here);
        if (max_ending_here < 0)
        {
            max_ending_here = 0;
        }
    }
    return max_so_far;
}
int maxSubArraySum ( vector < int > arr , int n ) { int max_so_far = INT_MIN , max_ending_here = 0 ; for ( int i = 0 ; i < n ; i ++ ) { max_ending_here = max_ending_here + arr [ i ] ; max_so_far = max ( max_so_far , max_ending_here ) ; if ( max_ending_here < 0 ) { max_ending_here = 0 ; } } return max_so_far ; }
Function to calculate Largest Sum Subarray
Function to calculate Largest Sum Subarray