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

Method sortArrayByParity

Array/SortArrayByParity.py:31–44  ·  view source on GitHub ↗

:type A: List[int] :rtype: List[int]

(self, A)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected