lintcode 373. 奇偶分割数组

难度:容易

1. Description

373. 奇偶分割数组

2. Solution

  • python
class Solution:
    """
    @param: nums: an array of integers
    @return: nothing
    """
    def partitionArray(self, nums):
        # write your code here
        n = len(nums)
        if n<=1:
            return nums
        left = 0
        right = n-1
        while True:
            while nums[left]%2!=0 and left0: # find odd num
                right-=1
            if left

3. Reference

  1. https://www.lintcode.com/problem/partition-array-by-odd-and-even/description?_from=ladder

你可能感兴趣的:(lintcode 373. 奇偶分割数组)