最大连续子序列的和
2022-03-15 本文已影响0人
xiaohei_e853
有一个数组,如1, -5, 8, 3, -4, 15, -8,查找其中连续和最大的相邻串的值。在本例中,最大值为8 + 3 + -4 + 15 = 22.
解法一,暴力枚举
解法二,在线处理
O(n)的算法复杂度

有一个数组,如1, -5, 8, 3, -4, 15, -8,查找其中连续和最大的相邻串的值。在本例中,最大值为8 + 3 + -4 + 15 = 22.
O(n)的算法复杂度