标签:self off HERE coding array pre color temp code
1 # -*- coding:utf-8 -*- 2 class Solution: 3 def reOrderArray(self, array): 4 n = len(array) 5 i = 0 6 while i < n: 7 if array[i] % 2 == 1: 8 i += 1 9 continue 10 j = i + 1 11 while j < n: 12 if array[j] % 2 == 1: 13 break 14 j += 1 15 if j == n: 16 return array 17 temp = array[j] 18 for k in range(j,i,-1): 19 array[k] = array[k-1] 20 array[i] = temp 21 i = i+1 22 return array 23 # write code here
标签:self off HERE coding array pre color temp code
原文地址:https://www.cnblogs.com/asenyang/p/11013117.html