Coding
Find the shortest path visiting all nodes in a graph.
You have an undirected, connected graph of n nodes. Return the length of the shortest path that visits every node. You may start and stop at any node, you may revisit nodes multiple times, and you may reuse edges.
Input: graph = [[1],[0,2],[1]]
Output: 2
Explanation: The graph is a straight line: 0-1-2. The shortest path visiting all nodes is 0 -> 1 -> 2, which requires 2 steps.
Was asked at