Please read the new rule regarding the restriction on the use of AI tools. ×

Most similar path in the graph

Revision en2, by swordx, 2022-01-30 21:59:51

Hello Guys,

Could you share your thoughts on the following question:

Given an undirected graph with node values as string, and a path to follow, you have to find a path which is most similar to the input path.

For example, for the following graph:

Please note that the value in the input path could be completely different from any existing node. The task is to find out a path which resembles the most with the given path. There could be multiple possible outputs.

Input Path: ["KPG"->"DPS"->"SIN"->"AUH"]

Expected Output: ["KUL"->"DPS"->"CGK"->"AUH"]

In the above example, the least number of changes that you have to make is to replace KPG with KUL, and SIN with CGK.

Input Path: ["XXX", "TBS", "DME"]

Expected Output: ["ATH", "TBS", "DME"]

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English swordx 2022-01-30 22:08:52 49
en3 English swordx 2022-01-30 22:07:28 811
en2 English swordx 2022-01-30 21:59:51 275
en1 English swordx 2022-01-30 20:01:54 630 Initial revision (published)