1
2
3
4
5
6
7
8
9
10
11
|
def sol(nums):
even_list=[]
odd_list=[]
for i in nums :
if i%2 == 0 : even_list.append(i)
else : odd_list.append(i)
even_list.extend(odd_list)
return even_list
class Solution:
def sortArrayByParity(self, nums: List[int]) -> List[int]:
return sol(nums)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1679. Max Number of K-Sum Pairs (0) | 2022.05.04 |
---|---|
leetcode 844. Backspace String Compare (0) | 2022.05.02 |
codeforces 1352A - Sum of Round Numbers (0) | 2022.05.02 |
codeforces 1335A - Candies and Two Sisters (0) | 2022.05.02 |
codeforces 1154A - Restoring Three Numbers (0) | 2022.04.29 |
댓글