Taken from geeksforgeeks:
Given a graph (Number of edges, number of nodes, From and To node pairs), you need to find the minimum weighted path from the first node(1) to the last node(N) and return it’s weight. If there exists no edge between any two vertices which would be required to complete the path from the first to the last node, then an edge can be created between them with the weight 1.
Could you please remind me what is the similar problem in LC? Is it available?
My thoughts are that we can find all connected components, connect them and then with help of BFS find the cheapest path.. am I correct?