I need an algorithm to find the subsequence of contiguous elements whose product is maximum. But I need to use recursion and then modify that recursion and apply memoization, how can i do it?, cause i have clear that the solution using brute force is:
def maxProduct(self, nums: List[int]) -> int:
if len(nums) == 0:
return 0
result = nums[0]
for i in range(len(nums)):
accu = 1
for j in range(i, len(nums)):
accu *= nums[j]
result = max(result, accu)
return result