4 ms·
You can do it by checking that the solution provided is a valid traversal of the graph, and does not touch two vertices twice. If there are N vertices, you can
by ctchocula 9y ago
You can do it by checking that the solution provided is a valid traversal of the graph, and does not touch two vertices twice. If there are N vertices, you can check in O(N) time.
- BLanen 9y agoIt's about validating the proposed solution on being the fastest path, not if the proposed solution is a valid path.