0977. 有序数组的平方

添加Java注释
This commit is contained in:
AronJudge
2022-06-26 23:50:32 +08:00
parent e8d1a1a36b
commit ffe981fb6c

View File

@ -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 {