1 min readFeb 6, 2020
One of the optimal solutions is to use a Map where you do O(n) to populate de map – then you iterate over second array and find if any element exist … In theory maps have no access O(1) guaranteed but I’m practice you can assume that leaving your best case to O(n)