至少长度l最大连续子总和总和、长度、最大

2023-09-10 23:48:36 作者:玩世吥塨

因此​​,对于下面的数组,其中L = 3

So for the following array, where L = 3

-5 -1 2 -3 0 -3 3

至少长3所述的最好的可能的总和将是0,其中子序列是最后三要素(0,-3,3)

The best possible sum of at least length 3 would be 0, where the subsequence is the last three elements (0, -3, 3)

您如何计算比O(NL)更快的这笔钱用于任何阵列(有效O(N ^ 2)如果L == 0)的时间?

How can you calculate this sum for any array in faster than O(NL) (effectively O(N^2) if L==0) time?

推荐答案

我相信,你可以在O(n)的时间通过使用的