leetcode-master icon indicating copy to clipboard operation
leetcode-master copied to clipboard

feat: 0977.有序数组的平方 ||| python3双指针三步优化

Open EthanLiu6 opened this issue 4 months ago • 0 comments

0977.有序数组的平方 ||| python3双指针三步优化 """ 整体思想:有序数组的绝对值最大值永远在两头,比较两头,平方大的插到新数组的最后 优 化:1. 优化所有元素为非正或非负的情况 2. 头尾平方的大小比较直接将头尾相加与0进行比较即可 3. 新的平方排序数组的插入索引可以用倒序插入实现(针对for循环,while循环不适用) """

EthanLiu6 avatar Oct 05 '24 04:10 EthanLiu6