264. Intersection of Two Sorted Lists
Two lists, each in non-decreasing order and each possibly containing
duplicates. Print every value that appears in BOTH, each exactly once, in
increasing order. If there is no such value, print None.
The two-pointer sweep is the same as the union, with the opposite rule about what to keep: advance the pointer at the smaller value, and record only when they are equal.
The empty case is worth handling deliberately. Printing nothing and printing
None look similar in a terminal and are different outputs.
Constraints - `1 ≤ n ≤ 100000` - `1 ≤ m ≤ 100000` - `-1000000000 ≤ values ≤ 1000000000`
Input
The first line contains two integers n and m.
The second line contains n integers in non-decreasing order.
The third line contains m integers in non-decreasing order.
Output
Print the shared values in increasing order separated by single spaces, or None if there are none.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.