mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Update minimum_partition.py
The loop for finding differences had issues of float being iterated. Has been fixed.
This commit is contained in:
parent
f9156cfb71
commit
247089decc
@ -20,7 +20,7 @@ def findMin(arr):
|
|||||||
if (arr[i-1] <= j):
|
if (arr[i-1] <= j):
|
||||||
dp[i][j] = dp[i][j] or dp[i-1][j-arr[i-1]]
|
dp[i][j] = dp[i][j] or dp[i-1][j-arr[i-1]]
|
||||||
|
|
||||||
for j in range(s/2, -1, -1):
|
for j in range(int(s/2), -1, -1):
|
||||||
if dp[n][j] == True:
|
if dp[n][j] == True:
|
||||||
diff = s-2*j
|
diff = s-2*j
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user