Question: It's BFS/DFS related problem. Hint : run regular BFS/DFS two times for two nodes and then compare. You must code in python. And before submitting
It's BFS/DFS related problem.
Hint : run regular BFS/DFS two times for two nodes and then compare.
You must code in python. And before submitting please check wether your code provides the correct output or not.

Nora has now been taken to "HigherLand" for Level 2 of the competition. Here she discovered that she will be competing with another participant "Lara". Here also there are n warriors in different fixed positions (position 0 through position n-1). Nora is now placed in position 'p' and Lara is placed in position 'q'. Both of them have to kill the warrior Lina in position 'x'. The one who goes to position 'x' first, wins Level 2. For n different positions and m connections (uv) among the positions, your task is to determine who can go to 'x' first -Nora or Lara? Where Nora is in position 'p' and Lara is in position 'q'. If both win, print both. Sample Input 9 /umber of different fixed positions (including Nora's one) 12 /umber of connections 0 1 //position 0 is connected with position 1 02 03 14 N 35 4 8 47 56 67 78 7 //'x'-Lina's position 5 // 'p'-Nora's position 3 // 'q'-Lara's position Sample Output Nora //winner, since Nora can go to 'x' with 2 moves and Lara can go with 3 moves The one who completes Level 2 of "Fight with Brain" will be rewarded with 30 points and a "WildCard" which can be used to bypass the next Level (Level 3) and proceed to Level 4 without losing any point. But if decided to take Level 3 and completed successfully, participant will be rewarded with 30 bonus points
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
