Intersection of two sorted arrays
Your task
Given two arrays a and b that are each sorted in ascending order (possibly with duplicates), return their intersection as a sorted list that includes each common value as many times as it appears in both (i.e., min multiplicity). Either array may be empty.
Examples
sorted_intersection(a: list[int], b: list[int]) -> list[int]Example 1
Input
sorted_intersection([1, 2, 2, 3], [2, 2, 4])Output
[2, 2]