时间不够,快速突击出效果。
步骤:
1、看题,思考5分钟,想不出来,看答案看明白;
2、看题如果思考出来,自己编程,不算作弊;
3、原先看答案的题目等吃饭之后再编程(隔得时间越久,记忆锻炼效果越好)。
4、hard类的题目直接看答案。
4. Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
Example 1:
nums1 = [1, 3] nums2 = [2] The median is 2.0
Example 2:
nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5