求最大子序列的和

来源:互联网 发布:怎样注销淘宝账户 编辑:程序博客网 时间:2024/06/05 00:56
public static int maxSubArray(int[] a){     int max = 0;      int thisSum = 0;      for (int i=0;i<a.length;i++){            thisSum += a[i];            if (thisSum>max)                max = thisSum;                 else if (thisSum<0)                thisSum = 0;        }        return max;        }
0 0