算法学习:给定一个序列求最大子序列的和

2021-05-28 22:02

阅读:647

标签:负数   +=   ring   算法学习   print   子序列   sum   学习   static   

题目

给定一个序列,给出最大子序列的和。

解答

public class maxSubSum {
    public static int maxSubSum1(int [] a){
        int maxSum = 0;
        for (int i = 0; i  maxSum){
                    maxSum = thisSum;
                }
            }
        }
        return maxSum;
    }


    public static int maxSubSum2(int [] a){
        int maxSum = 0;
        for (int i = 0; i  maxSum){
                maxSum = thisSum;
            // System.out.println("sss:"+maxSum);
            }else if(thisSum 

算法学习:给定一个序列求最大子序列的和

标签:负数   +=   ring   算法学习   print   子序列   sum   学习   static   

原文地址:https://www.cnblogs.com/hqq2019-10/p/14779093.html


评论


亲,登录后才可以留言!