给出一个数组A,尝试求解最大子序列 产品问题算法。因此,该函数应使用动态编程返回具有最大乘积的子序列的开始和结束索引。例如:
funcSubSeqMaxProduct(A[1..n]) {
return j,k #Where j<=k and A[j,...k] is the maximum sub sequence product.
}
到目前为止,我尝试过的是:
funcSubSeqMaxProduct(A[1..n]) {
for i = 1 to n
pro(i) = max(ai, pro(i-1)*ai)
j = max(pro(i))
#something I am struggling how to get the correct indices of lower and upper bound.
return j,k
}