Dev747 Posted August 20, 2015 Share Posted August 20, 2015 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-->CA-->BC-->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-->BB-->CC-->DThe 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. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.