双指针,块排模板
class Solution:
"""
@param: nums: an array of integers
@return: nothing
"""
def partitionArray(self, nums):
# write your code here
i = 0; j = len(nums) - 1
while i <= j:
while i <= j and nums[i] % 2: i += 1
while i <= j and not nums[j] % 2: j -= 1
if i <= j:
nums[i], nums[j] = nums[j], nums[i]
i += 1; j -= 1