I have two lists of strings:
a = ['ab','ac','ad',..., 'aba','abc',...] # n = 10000 of unique strings
b = ['ab', 'ac', ..., 'ab'] # m = 100 have duplicates
c = []
How to find common string between these two strings? My solution runs in m*n complexity (right?):
for i in a:
if i in b:
c.append(i)
is there a way to solve it in O(m) time complexity?