mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 08:50:15 +08:00
Merge pull request #377 from jojoo15/patch-35
优化 1005.K次取反后最大化的数组和 python3版本
This commit is contained in:
@ -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)
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user