1def intersection(A, B, C):
2 '''
3 Intersection of 3 array in O(n).
4 '''
5 i = j = k = 0
6 len1 = len(A)
7 len2 = len(B)
8 len3 = len(C)
9
10 while (i < len1 and j < len2 and k< len3):
11
12 if (A[i] == B[j] and B[j] == C[k]):
13 print(A[i])
14 i += 1
15 j += 1
16 k += 1
17 elif A[i] < B[j]:
18 i += 1
19 elif B[j] < C[k]:
20 j += 1
21 else:
22 k += 1
23