第二天任务:
977.有序数组的平方,209.长度最小的子数组,59.螺旋矩阵II
977.有序数组的平方
题目链接:https://leetcode.cn/problems/squares-of-a-sorted-array/
1. 直接排序
1)sorted() 函数


2) list.sort()

3) 冒泡排序

4)

2. 双指针解法
思路:977. 有序数组的平方 - 力扣(Leetcode)

后来参考大神答案,才发现while循环部分是可以简化的。。。

Tips:
# 存储结果数组,从数组末尾开始存储 res = [-1] * len(nums) 或者 res = [0] *len(nums)
209.长度最小的子数组
题目链接: https://leetcode.cn/problems/minimum-size-subarray-sum/
1. 自己做的暴力解法(我只能写出这么烂的......):

2. 滑动窗口:



代码随想录 (programmercarl.com)

209. 长度最小的子数组 - 力扣(Leetcode)

209. 长度最小的子数组 - 力扣(Leetcode)
59.螺旋矩阵II
题目链接:https://leetcode.cn/problems/spiral-matrix-ii/
1)自己做的



2)

3)力扣官方题解

for _ in range ()
python中for _ in range ()代码中‘_‘的意思_沉醉,于风中的博客-CSDN博客_for in range是什么意思

思路: