From 55e44db5faa674a5907129cd5bd8aeb26e7f1521 Mon Sep 17 00:00:00 2001 From: haiker2011 Date: Thu, 11 Oct 2018 19:59:53 +0800 Subject: [PATCH] add #20 python implement --- notes/面试总结.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/notes/面试总结.md b/notes/面试总结.md index 867fb55c..9b841f92 100644 --- a/notes/面试总结.md +++ b/notes/面试总结.md @@ -1681,6 +1681,16 @@ class Solution: return copyArray ``` +```python +# -*- coding:utf-8 -*- +class Solution: + def reOrderArray(self, array): + # write code here + odd = [x for x in array if x%2] + even = [x for x in array if not (x%2)] + result = odd + even + return result +``` # 参考文献