PAT-A 1029 Median (25)

  被测试点卡哭了,时间和内存都很抠。使用 Two Pointers 思想。

Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of $S_1$ = { 11, 12, 13, 14 } is 12, and the median of $S_2$ = { 9, 10, 15, 16, 17 } is 15. The median of two sequences is defined to be the median of the nondecreasing sequence which contains all the elements of both sequences. For example, the median of $S_1$ and $S_2$ is 13.

Given two increasing sequences of integers, you are asked to find their median.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×