Update 0977.有序数组的平方.md

python3 version of brutal force
This commit is contained in:
JaneyLin
2022-06-06 22:11:16 -05:00
committed by GitHub
parent 87abfa1664
commit 722a32cd2a

View File

@ -39,6 +39,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)