—Easy

https://leetcode.com/problems/squares-of-a-sorted-array/Leetcode-977. Squares of a Sorted Array

Code:

 

class Solution:
    def sortedSquares(self, A) :
        ans_list = []
        for elt in A:
            ans_list.append(elt*elt)
        ans_list.sort()
        return ans_list

# s = Solution()
# print(s.sortedSquares([-4,-1,0,3,10]))
# print(s.sortedSquares([-7,-3,2,3,11]))

相关文章:

  • 2022-01-19
  • 2021-07-04
  • 2021-09-28
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-18
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案