Problem Statement:
Uber is designing a citywide internal communication network between its operational hubs such as driver support centers, regional dispatch hubs, and surge-control nodes. Every hub must be able to communicate with every other hub, either directly or indirectly.
The city is modeled as a complete network of Uber hubs. However, some connections already require paid infrastructure upgrades, while others can be connected at no additional cost.
You are given an undirected complete graph with g_nodes Uber hubs. The cost of connecting any two hubs is either 1 or 0.
There are exactly g_edges connections listed that require an upgrade with cost equal to 1. These connections are provided using two arrays, g_from and g_to, where each pair represents an undirected connection between two hubs that costs 1. All other possible connections between hubs have a cost of 0.
Given the list of upgrade-required connections, determine the minimum total upgrade cost required to connect all Uber hubs.
Example:
Consider the number of Uber hubs to be g_nodes = 4 and the number of upgrade-required connections g_edges = ... (Example data continues based on specific test cases).
Function Description:
Complete the findMinimumCost function. It has the following parameters:
int gNodes: The total number of Uber hubs.
List<Integer> gFrom: An array representing one end of the connections that cost 1.
List<Integer> gTo: An array representing the other end of the connections that cost 1.
Returns:
int: The minimum total upgrade cost required to connect all Uber hubs.