## Python

```
arr1, arr2 = [1, 3, 2, 7, 4], [12, 1, 3, 6, 8, 7, 4]
```

Solution 1 (`O(n*m)`

):

```
inxsn = []
for i in arr1:
for j in arr2:
if i == j:
inxsn.append(i)
break
print(inxsn)
#→ [1, 3, 7, 4]
```

Solution 2 (`O(n)`

):

```
inxsn = []
for i in arr1:
if i in arr2:
inxsn.append(i)
print(inxsn)
#→ [1, 3, 7, 4]
```

Solution 3: List comprehension

```
print(
[i for i in arr1 if i in arr2]
)
#→ [1, 3, 7, 4]
```