Your question is Array Intersection Implementation. 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.
Piping Rock Health Products receives product identifier lists from two fulfillment workflows. Given two integer arrays, return the distinct identifiers that appear in both arrays, preserving the order of their first appearance in arr1.
Implement find_intersection(arr1, arr2), where arr1 and arr2 are arrays of integers. Return a new array containing each common value exactly once. The result must follow the order established by the first occurrence of each value in arr1.
Do not modify either input array. If the arrays have no common values, return an empty array.
def find_intersection(arr1, arr2):