Company: DocuSign_5april
Difficulty: medium
Minimum Road Repair Cost Problem Description Hackerland has g_nodes cities, numbered from 1 to g_nodes , joined by g_edges bidirectional roads. Road i joins city g_from[i] and city g_to[i] , and its repair cost is g_weight[i] . Every road starts out damaged. If you spend an amount X , then every road whose repair cost is less than or equal to X becomes usable, and every road costing more than X stays damaged. You may only travel along usable roads. Your task is to travel from city 1 to city g_nodes using at most k roads , while spending as little as possible. Return the smallest amount X that makes such a journey possible, or -1 if no amount of money makes it possible. Function Description Complete the function getMinRepairCost . getMinRepairCost has the following parameters: int g_nodes : the number of cities int g_from[g_edges] : cities at one end of each bidirectional road int g_to[g_edges] : cities at the other end of each bidirectional road int g_weight[g_edges] : the repair cost