Given an undirected graph of n nodes in which one node is malware node, return all paths from source to destination which doesn't contain the malware node.
1 - 2 - 3
| |
(6) - 5 - 4Here, malware node is 6, source is 1 and destination is 5. So, the paths from 2->5 are 2->3->4->5 and 2->1->6->5 but the paths which contains malware node is not valid. Hence, return path 2->3->4->5.
I received this problem at an on-site interveiw at Google for a Software intern position. We spent about half an hour on this problem. He didn't ask this problem directly but it's similar like CP questions. I think this question would be a LeetCode Medium.
I want to contribute this question, so that it will help someone else because I know a single question related to that company or position matters before the interview. I hope this will help you.
Thank you :)