Category: graph
Given a directed graph represented as an adjacency list, return its reverse so if an edge goes from A to B, it now goes from B to A. Each …
There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys …
Given a graph represented by G(V, E) where V is the vertices and E represents the edges, we can do a Depth First Search Algorithm (DFS) on any node/vertex. …
There are N cities numbered from 1 to N. You are given connections, where each connections = represents the cost to connect city1 and city2 together. (A connection is …
According to the definition of tree on Wikipedia: “a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any …