[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)