Return a sorted list of the different values that appear in both a and b. The lists are not sorted and can contain repeats.
The starter code looks every value up in the other list with a linear search. It is correct but too slow. Make it fast.
Example 1
Input:
common_values([1, 2, 2, 3], [2, 2, 3, 4])
Output:
[2, 3]
Example 2
Input:
common_values([1], [2])
Output:
[]
0 <= len(a), len(b) <= 2 * 10**5-10**9 <= value <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.