I’m not sure why the time complexity for this solution is O(m+n).
Isn’t this “searching” for an element from list2 against list1, so number of elements in list2 n * O(1) = O(n)?
If it’s regarding the worst-case scenario, then isn’t it O(m x n)?
Type your question above this line.
Course: https://www.educative.io/collection/5642554087309312/5634727314718720
Lesson: https://www.educative.io/collection/page/5642554087309312/5634727314718720/5644534738321408