算法题是这个:
https://leetcode.com/problems/median-of-two-sorted-arrays/description/
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays.
我写的代码在这里:
https://gist.github.com/BryanJin/409a6ef9a52d544621b6e0ca430b3762
之前在 leetcode 上死活不通过,自己 debug 了半天没发现问题,结果是 Python 版本错了。
测试输入: [1, 2] [3, 4]
Python2 的运行结果是 2
Python3 的运行结果是 2.5
为啥会有这种神奇的现象