Jump to content

Dev747

New Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Dev747

  • Rank
    Newbie
  1. Of course those solution will work. Actually I was concerned about the solutions given using 'sort' function. By the way thanks for the help.
  2. Thank you guys for the help. Actually I forgot to mention that the solution was supposed to be applicable for any possible set of inputs. In such case we cannot use ‘sort’ function. For example if B is source and C is destination and the correct sequence of paths are B->A , A->D, D->C which is to be determine from given set of inputs ( path sequences in random order ).I think the logic here would be that we have to start from source and then 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. Please correct me if I'm wrong.
  3. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.