[LeetCode] Sort Array By Parity (Python)
2024. 2. 29. 14:35ㆍ자료구조
class Solution:
def sortArrayByParity(self, nums: List[int]) -> List[int]:
return sorted(nums, key=lambda x: x%2)
'자료구조' 카테고리의 다른 글
[LeetCode] Third Maximum Number (Python) (0) | 2024.03.03 |
---|---|
[LeetCode] Height Checker (Python) (0) | 2024.03.03 |
[LeetCode] Move Zeroes (Python) (0) | 2024.02.29 |
[LeetCode] Replace Elements with Greatest Element on Right Side (Python) (0) | 2024.02.29 |
[LeetCode] Valid Mountain Array (Python) (0) | 2024.02.29 |