hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9K
active users

Šimon Tóth

Sunday common C++ interview problem: Shortest path to visit all nodes.

Given a connected graph as an adjacency list (std::vector<std::vector<unsigned>>), return the length of the shortest path that visits all nodes.

The path may revisit nodes and edges. You can assume a computationally feasible number of nodes.

Solve it yourself: compiler-explorer.com/z/qz9G3z
Solution: compiler-explorer.com/z/bv6evY