Algorithms and Programming 101 by @OKSoFar
English
Intermediate
❶ Before you hit 'start', please keep a pen and a paper ready, some questions may require you to work out a solution. ❷ As soon as you answer a question, timer for the next question starts. So, DO NOT spend time on the explanation, you can look it up anytime later using the 'lamp' button. ❸ Channel @OKSoFar has a list of more such quizzes, do check them out.
Description
Tags
30
Questions
3 min
Per question
11:55
Average time
4.2
Contest Score
12
Participants
Educational explanations. 👍 Explanations cover why the correct answers are correct and why the wrong answers are wrong (when appropriate). E.g.: #q1, #q2, #q3 etc
I know about discovery time for DFS, but not for BFS. I think that such term doesn't exist. Is there some source where discovery time for BFS is described?
Your answer is O(nm), but I can do this in O(nlogn+mlogm) in following way: sort both sets in O(nlogn+mlogm) and then find intersection using one cycle through them in O(n+m).