Merge pull request #377 from jojoo15/patch-35

优化 1005.K次取反后最大化的数组和 python3版本
This commit is contained in:
程序员Carl
2021-06-11 15:35:30 +08:00
committed by GitHub

View File

@ -133,7 +133,7 @@ class Solution:
A[i] *= -1
K -= 1
if K > 0:
A[len(A) - 1] *= ((-1)**K)
A[-1] *= (-1)**K #取A最后一个数只需要写-1
return sum(A)
```