While processing value lists from Meesho Catalog workflows, find the values that appear in both input arrays. Return each common value only once, arranged in ascending numeric order.
Implement intersection_sorted(arr1, arr2).
arr1 and arr2.Example 1
Input: arr1 = [5, 2, 2, 8, 1], arr2 = [2, 3, 5, 5]
Output: [2, 5]
The values 2 and 5 occur in both arrays. Duplicates are removed, and the result is sorted.
Example 2
Input: arr1 = [7, 4, 9], arr2 = [1, 2, 3]
Output: []
The arrays have no common values.
0 <= len(arr1), len(arr2) <= 10^5-10^9 <= arr1[i], arr2[i] <= 10^9def intersection_sorted(arr1, arr2):