We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 805443d commit e8d06e3Copy full SHA for e8d06e3
dp.py
@@ -1,7 +1,7 @@
1
def solve_pizza(nums, target):
2
dp = [[None for _ in range(len(nums))] for _ in range(target+1)]
3
4
- dp[nums[0]][0] = [nums[0]]
+ dp[nums[0]][0] = [0]
5
6
for j in range(len(nums)):
7
dp[0][j] = []
@@ -14,7 +14,7 @@ def solve_pizza(nums, target):
14
continue
15
if i-nums[j] >= 0:
16
if dp[i-nums[j]][j-1] is not None:
17
- dp[i][j] = list(dp[i-nums[j]][j-1] + [nums[j]])
+ dp[i][j] = list(dp[i-nums[j]][j-1] + [j])
18
19
for i in range(target, -1, -1):
20
if dp[i][-1] is not None:
0 commit comments