mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
removed my code from challenge
This commit is contained in:
parent
7ffe77b236
commit
47750576ba
|
@ -70,37 +70,15 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 1,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def make_order_list(list_in):\n",
|
|
||||||
" order_list = []\n",
|
|
||||||
" for item in list_in:\n",
|
|
||||||
" if item not in order_list:\n",
|
|
||||||
" order_list.append(item)\n",
|
|
||||||
" return order_list\n",
|
|
||||||
"\n",
|
|
||||||
"def group_ordered(list_in):\n",
|
"def group_ordered(list_in):\n",
|
||||||
" if list_in is None:\n",
|
" # TODO: Implement me\n",
|
||||||
" return None\n",
|
" pass"
|
||||||
" order_list = make_order_list(list_in)\n",
|
|
||||||
" current = 0\n",
|
|
||||||
" for item in order_list:\n",
|
|
||||||
" search = current + 1\n",
|
|
||||||
" while True:\n",
|
|
||||||
" try:\n",
|
|
||||||
" if list_in[search] != item:\n",
|
|
||||||
" search += 1\n",
|
|
||||||
" else:\n",
|
|
||||||
" current += 1\n",
|
|
||||||
" list_in[current], list_in[search] = list_in[search], list_in[current]\n",
|
|
||||||
" search += 1\n",
|
|
||||||
" except IndexError:\n",
|
|
||||||
" break\n",
|
|
||||||
" return list_in"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user