mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Fixed Python2 vs Python3 division compatibility.
This commit is contained in:
parent
b57ca00bb2
commit
9df39726c1
|
@ -33,7 +33,6 @@
|
|||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"* Is a naiive solution sufficient?\n",
|
||||
" * Yes"
|
||||
]
|
||||
|
@ -87,6 +86,9 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from __future__ import division\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def merge(left, right):\n",
|
||||
" l = 0\n",
|
||||
" r = 0\n",
|
||||
|
@ -111,7 +113,7 @@
|
|||
"def merge_sort(data):\n",
|
||||
" if len(data) < 2:\n",
|
||||
" return data\n",
|
||||
" mid = len(data) / 2\n",
|
||||
" mid = int(len(data) / 2)\n",
|
||||
" left = data[0:mid]\n",
|
||||
" right = data[mid:len(data)]\n",
|
||||
" left = merge_sort(left)\n",
|
||||
|
|
Loading…
Reference in New Issue
Block a user