A country consists of cities connected by bidirectional roads. Each road has a fuel requirement equal to its weight.
You are given:
arr, where arr[i] denotes the fuel price per unit in city i.A.B.Your truck has:
Find the minimum cost required to travel from city A to city B. If no path exists, return -1.
Fuel Prices: arr = [9, 11, 3, 2, 10]
Suppose the optimal route is: 3 → 5 → 1 → 4 → 2
Strategy:
Output: 27