Criteo interview question

Write a function to find the intersection between two arrays.

Interview Answer

Anonymous

11 Sept 2021

there are many ways to write this function. If we want just to use native python language we can do : def inter(l1, l2): l3 = [v for v in l1 if v in l2] return l3 or we can for example use the intersection function like : def inter(l1, l2): l3 = set(l1).intersection(l2) return l3