描述
None
tags: partition
思路
快排
class Solution(object):
def exchange(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
l, r = 0, len(nums) - 1
while l < r:
while l < r and nums[l] % 2 != 0:
l += 1
while l < r and nums[r] % 2 == 0:
r -= 1
t = nums[l]
nums[l] = nums[r]
nums[r] = t
return nums