If there are no space constrains, then convert one of the arrays into hashtable in O(m), and iterate over the other array to find if the value exists in the hashtable in O(n). Total O(m+n).
3
Utilisateur anonyme
3 févr. 2016
Sort the smaller list. Then binary search each element in the sorted array.
mlogm + nlogm = (m+n)logm
1
Utilisateur anonyme
8 févr. 2016
how long did it take to get the final desicion after the phone interview?