mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
0977. 有序数组的平方
添加Java注释
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user