← Questions
Validate a Hamiltonian path given as strings
0
I was asked this
No reports yet. Sign in to say where you were asked it.
You get three strings: the vertices of an undirected graph like "(A,B,C)", its edges like "(A-B,B-C)", and a proposed visiting order like "(C,B,A)".
Return "yes" when the order visits vertices of the graph, never repeats one, and every two consecutive vertices share an edge. Otherwise return the first vertex in the order where one of those checks breaks.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
