Your question is Array Common Elements. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Cloudera Data Platform processing component receives two batches of integer identifiers and needs to determine which identifiers appear in both batches. Return the unique common elements, preserving the order in which they first appear in nums1.
Implement a function that does not modify either input array.
Given two arrays of integers, nums1 and nums2, return an array containing every distinct value that occurs at least once in both arrays. The result must follow nums1's first-occurrence order. If there are no common values, return an empty array.
def common_elements(nums1, nums2):