[LeetCode] Squares of a Sorted Array (Python)

2024. 2. 27. 10:22자료구조

 

class Solution:
    def sortedSquares(self, nums: List[int]) -> List[int]:
        square = []
        for i in range(len(nums)):
            square.append(nums[i]**2)
        square = sorted(square)
        
        return square