We are required to count and return occurences of elements that are present in both arrays.
Code
Python3
Big O Analysis
-
Runtime
The runtime complexity here is since we are visiting all elements in the array only once.
-
Memory
The memory usage is since we use the
collections.Counter
object to store frequencies.
— A