Python 6 lines easy to understand DFS w/ memoization
\nclass Solution:\n    def maxCoins(self, nums):\n        memo, nums = {}, [1] + [num for num in nums if num] + [1]\n        def dfs(l, r):\n            if r - 
```\nclass Solution:\n    def maxCoins(self, nums):\n        memo, nums = {}, [1] + [num for num in nums if num] + [1]\n        def dfs(l, r):\n            if r - l == 1: return 0\n            if (l, r) not in memo: memo[(l, r)] = max(nums[l] * nums[i] * nums[r] + dfs(l, i) + dfs(i, r) for i in range(l + 1, r))\n            return memo[(l, r)]\n        return dfs(0, len(nums) - 1)\n```
[]