solution hint: use bfs, paying special attention to the nodes that are distance 2 from the source. if a simple cycle exists, what will you observe while running the bfs? how long does bfs take? how many times would you have to run



Answer :