def sortedSquares(self, nums: List[int]) -> List[int]: for i in range(0,len(nums)): ##在这!!!! nums[i]=nums[i]*nums[i] nums.sort() return nums
时间复杂度为O(n)的做法看下:
https://leetcode-cn.com/problems/squares-of-a-sorted-array/
2023-10-02 18:06:22
def sortedSquares(self, nums: List[int]) -> List[int]: for i in range(0,len(nums)): ##在这!!!! nums[i]=nums[i]*nums[i] nums.sort() return nums
时间复杂度为O(n)的做法看下:
https://leetcode-cn.com/problems/squares-of-a-sorted-array/
下一篇:pytest 常用方法介绍