Hard35 min
Path in a Graph
The adjacency object value maps nodes to their neighbors. Return whether a path exists from extra[0] to extra[1].
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[{"a":["b"],"b":["c"],"c":[]},["a","c"]]Output:
trueInput:
[{"a":[],"b":[]},["a","b"]]Output:
falseConstraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.