Merge pull request #322 from SkyLazy/patch-1

Update 1005.K次取反后最大化的数组和.md
This commit is contained in:
Carl Sun
2021-06-04 23:21:48 +08:00
committed by GitHub

View File

@ -102,7 +102,7 @@ Java
```java
class Solution {
public int largestSumAfterKNegations(int[] A, int K) {
if (A.length == 1) return A[0];
if (A.length == 1) return k % 2 == 0 ? A[0] : -A[0];
Arrays.sort(A);
int sum = 0;
int idx = 0;