Company: Typeface_26july
Difficulty: medium
Minimum Travel Cost Problem Description The country of Hackerland is depicted as a graph with g_nodes cities, numbered from 1 to g_nodes. These cities are interconnected by g_edges bidirectional roads, where the i th road connects city g_from[i] to city g_to[i], and the fuel required to travel this road is g_weight[i] units. Vehicles in Hackerland have unlimited fuel capacity, and the cost of one unit of fuel in the k th city is given by arr[k]. Any amount of fuel can be purchased in any city. Given two cities A and B (1 ≤ A, B ≤ g_nodes), determine the minimum cost to travel from city A to city B. If travel between these cities is impossible, return -1. Examples Example 1: Input: g_nodes = 5 g_from = [4, 5, 4, 1, 3, 4] g_to = [1, 3, 5, 5, 1, 2] g_weight = [1, 1, 8, 1, 3, 9] arr = [9, 1, 3, 2, 3] A = 3 B = 2 Output: 27 Explanation: Nodes are labeled <city number>:<fuel cost>. One optimal path is 3 → 5 → 1 → 4 → 2. Buy 3 units of fuel at city 5 with