1
2
3
4
5
6
7
8
9
|
pypythonpythoclass Solution:
def sortArrayByParity(self, nums: List[int]) -> List[int]:
tmp=[]
tmp2=[]
for i in range(len( nums) ) :
if nums[i]%2==0: tmp.append(nums[i])
else: tmp2.append(nums[i])
tmp.extend(tmp2)
return tmp
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
Leetcode 709. To Lower Case (0) | 2021.08.17 |
---|---|
Leetcode 1295. Find Numbers with Even Number of Digits (0) | 2021.08.17 |
Leetcode 1827. Minimum Operations to Make the Array Increasing (0) | 2021.07.21 |
Leetcode 1323. Maximum 69 Number (0) | 2021.07.21 |
백준 2864 5와 6의 차이 (0) | 2021.07.20 |
댓글