Given three integer arrays
arr3 sorted in strictly increasing order, return a sorted array of only the integers that appeared in all three arrays.
Input: arr1 = [1,2,3,4,5], arr2 = [1,2,5,7,9], arr3 = [1,3,4,5,8] Output: [1,5] Explanation: Only 1 and 5 appeared in the three arrays.
Input: arr1 = [197,418,523,876,1356], arr2 = [501,880,1593,1710,1870], arr3 = [521,682,1337,1395,1764] Output: 
1 <= arr1.length, arr2.length, arr3.length <= 1000
1 <= arr1[i], arr2[i], arr3[i] <= 2000
Convert to sets and find intersections.
class Solution: def arraysIntersection(self, arr1: List[int], arr2: List[int], arr3: List[int]) -> List[int]: set1 = set(arr1) set2 = set(arr2) set3 = set(arr3) return sorted(set3.intersection(set1, set2))
- Time Complexity: O(NlogN)
- Space Complexity: O(N)