---
title: "1770. Maximum Score from Performing Multiplication Operations"
url: "https://laigary.com/interview/coding/1770-maximum-score-from-performing-multiplication-operations"
type: "note"
section: "coding"
date: "2024-01-05"
updated: "2026-07-27"
tags: ["Dynamic Programming"]
---

# 1770. Maximum Score from Performing Multiplication Operations

[1770\. Maximum Score from Performing Multiplication Operations](https://leetcode.com/problems/maximum-score-from-performing-multiplication-operations/)

Top-Down

```python
class Solution:
    def maximumScore(self, nums: List[int], multipliers: List[int]) -> int:

        @lru_cache
        def helper(leftBound, rightBound, i):
            if i == len(multipliers):
                return 0
            multiplier = multipliers[i]

            return max(
                multiplier * nums[leftBound] + helper(leftBound + 1, rightBound, i + 1),
                multiplier * nums[rightBound] + helper(leftBound, rightBound - 1, i + 1))

        return helper(0, len(nums) - 1, 0)
```
```python
class Solution:
    def maximumScore(self, nums: List[int], multipliers: List[int]) -> int:
        
        m = len(multipliers)

        @cache
        def helper(left, i):
            if i == m:
                return 0

            multiplier = multipliers[i]
            right = len(nums) - 1 - (i - left)

            l = nums[left] * multiplier + helper(left + 1, i + 1)
            r = nums[right] * multiplier + helper(left, i + 1)
            return max(l, r)

        return helper(0, 0)
```
