public static int maxSub(int []a)
{
int maxSum = 0;
int thisSum = 0;
for (int i=0; i < a.size() ;i++)
{
thisSum += a[i];
if (thisSum > maxSum)
{
maxSum = thisSum;
}
else if (thisSum < 0)
{
thisSum = 0;
}
}
return maxSum;
}
{
int maxSum = 0;
int thisSum = 0;
for (int i=0; i < a.size() ;i++)
{
thisSum += a[i];
if (thisSum > maxSum)
{
maxSum = thisSum;
}
else if (thisSum < 0)
{
thisSum = 0;
}
}
return maxSum;
}