3
20 20 100 100
35 35 50 50 0
30 30 25 25 0
40 40 60 60 100
Sir please explain 3rd test case
hello @uditkumar652
from 20 20 to 25 25 -> time 10
then 25 25 to 30 30 -> time 0
then 30 30 to 35 35 -> time 10
then 35 35 to 50 50 -> time 0
then 50 50 to 100 100 -> time 100
total time=10+0+10+100 =>120
sir i do not get this problem please provide video hint for this problem
sir is it nessary that x and y has same value
and which data structure should i use to store the input
can i use vactor<vector> v for this priblem
@uditkumar652
see solution is simple,u need to write a brute solution for this problem. that is u need try all possible way of reaching destination and consider the one with less time.
if u want hint video then pls write to -> [email protected] ,
also write the same in ur whatsapp grp ,ur mentor might help.
refer this code ->
sir please tell me the brute force approch as i am not able to start this problem
bro it is dfs only.
once check the code i shared above.
if pipe is visited then continue.
otherwise
if a–b is pipe
then from current position try both ways ie enter from a side and exit to b .
or enter from b and exit to a.
then call the same function to new position.
this line is updating min time .
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.