MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

Array/SortArrayByParityII.py:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25"""
26class Solution(object):
27 def sortArrayByParityII(self, A):
28 """
29 :type A: List[int]
30 :rtype: List[int]
31 """
32
33 odd = []
34 even = []
35
36 for i in A:
37 if i%2 == 0:
38 even.append(i)
39 else:
40 odd.append(i)
41
42 result = []
43 for j, k in zip(even, odd):
44 result.append(j)
45 result.append(k)
46 return result
47

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected