From ffe981fb6c5af5c7400f3b82c455b80ac8333fc0 Mon Sep 17 00:00:00 2001 From: AronJudge <2286381138@qq.com> Date: Sun, 26 Jun 2022 23:50:32 +0800 Subject: [PATCH] =?UTF-8?q?0977.=20=E6=9C=89=E5=BA=8F=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E7=9A=84=E5=B9=B3=E6=96=B9=20=E6=B7=BB=E5=8A=A0Java=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0977.有序数组的平方.md | 1 + 1 file changed, 1 insertion(+) diff --git a/problems/0977.有序数组的平方.md b/problems/0977.有序数组的平方.md index 20bdf7b0..d274d778 100644 --- a/problems/0977.有序数组的平方.md +++ b/problems/0977.有序数组的平方.md @@ -106,6 +106,7 @@ class Solution { int index = result.length - 1; while (left <= right) { if (nums[left] * nums[left] > nums[right] * nums[right]) { + // 正数的相对位置是不变的, 需要调整的是负数平方后的相对位置 result[index--] = nums[left] * nums[left]; ++left; } else {