728x90
https://leetcode.com/problems/squares-of-a-sorted-array/
class Solution:
def sortedSquares(self, nums: List[int]) -> List[int]:
nums = sorted(nums, key=abs)
return [i * i for i in nums]
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 1757. Recyclable and Low Fat Products (0) | 2023.08.21 |
---|---|
[Leetcode] 1346. Check If N and Its Double Exist (0) | 2023.08.21 |
[Leetcode] 1295. Find Numbers with Even Number of Digits (0) | 2023.08.19 |
[Leetcode] 485. Max Consecutive Ones (0) | 2023.08.19 |
[Leetcode] 1523. Count Odd Numbers in an Interval Range (0) | 2023.08.18 |