I'm a newbie to PHP and recently had a interview which required to write code in PHP for the following problem and which I was unable to do so. Please help with possible solutions (preferably with codes).
Problem : A person wants to travel from one point to another where A is the source point and D is the destination point. The inputs to the problem consisted of paths to be traversed while traversing from source to destination as follows : B-->C A-->B C-->D ( The input paths are to be considered in these orders only) The aim is to give correct sequence of paths which is as follows : A-->B B-->C C-->D The interviewer gave hint that in the correct sequence of paths ( A-->B , B-->C , C-->D ), the end point of the 1st path is the start point of the 2nd path and the end point of the 2nd path is the start point of the 3rd path. He also stated that it can be achieved with associative arrays in PHP.