Merge pull request #3 from janeyziqinglin/janeyziqinglin-patch-3

Update 0977.有序数组的平方 python版本
This commit is contained in:
JaneyLin
2022-06-16 10:07:05 -05:00
committed by GitHub

View File

@ -41,6 +41,15 @@ public:
}
};
```
```python3
class Solution:
def sortedSquares(self, nums: List[int]) -> List[int]:
res=[]
for num in nums:
res.append(num**2)
return sorted(res)
```
这个时间复杂度是 O(n + nlogn) 可以说是O(nlogn)的时间复杂度但为了和下面双指针法算法时间复杂度有鲜明对比我记为 O(n + nlog n)