a and b are sorted in non-decreasing order. Return a sorted list of the values they share, where a value that appears x times in a and y times in b appears min(x, y) times in the result.
Example 1
Input:
intersection_sorted([1, 2, 2, 3], [2, 2, 2, 4])
Output:
[2, 2]
2 appears twice in a and three times in b, so it appears twice.
Example 2
Input:
intersection_sorted([1, 2], [3, 4])
Output:
[]
0 <= len(a), len(b) <= 2 * 10**5No results yet
Run your code to check it against the examples, or submit to run every test.