Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortest Path Visiting All Nodes #94

Open
saakshii12 opened this issue Sep 30, 2023 · 2 comments
Open

Shortest Path Visiting All Nodes #94

saakshii12 opened this issue Sep 30, 2023 · 2 comments

Comments

@saakshii12
Copy link
Contributor

Write code in the preferred language and attach output with it.

You have an undirected, connected graph of n nodes labeled from 0 to n - 1. You are given an array graph where graph[i] is a list of all the nodes connected with node i by an edge.

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.

Example 1:
image
Input: graph = [[1,2,3],[0],[0],[0]]
Output: 4
Explanation: One possible path is [1,0,2,0,3]

Example 2:
image
Input: graph = [[1],[0,2,4],[1,3,4],[2],[1,2]]
Output: 4
Explanation: One possible path is [0,1,4,2,3]

@Esha-in-arena
Copy link

hey . @saakshii12 i know how to do it .could you please assign this to me .

@vrishitagharte
Copy link

Vrishita Gharte
UEC2021128
[email protected]
TY ENTC
can i please work on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants