mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-11 04:54:51 +08:00
Fix spelling error
This commit is contained in:
@ -253,14 +253,14 @@ Python:
|
|||||||
```python
|
```python
|
||||||
class Solution:
|
class Solution:
|
||||||
def canPartition(self, nums: List[int]) -> bool:
|
def canPartition(self, nums: List[int]) -> bool:
|
||||||
taraget = sum(nums)
|
target = sum(nums)
|
||||||
if taraget % 2 == 1: return False
|
if target % 2 == 1: return False
|
||||||
taraget //= 2
|
target //= 2
|
||||||
dp = [0] * 10001
|
dp = [0] * 10001
|
||||||
for i in range(len(nums)):
|
for i in range(len(nums)):
|
||||||
for j in range(taraget, nums[i] - 1, -1):
|
for j in range(target, nums[i] - 1, -1):
|
||||||
dp[j] = max(dp[j], dp[j - nums[i]] + nums[i])
|
dp[j] = max(dp[j], dp[j - nums[i]] + nums[i])
|
||||||
return taraget == dp[taraget]
|
return target == dp[target]
|
||||||
```
|
```
|
||||||
Go:
|
Go:
|
||||||
```go
|
```go
|
||||||
|
Reference in New Issue
Block a user