Get Minimum Time
Developers at Amazon have deployed an application with a distributed database. It is stored on total_servers different servers numbered from 1 to total_servers that are connected in a circular fashion, i.e. 1 is connected to 2, 2 is connected to 3, and so on until total_servers connects back to 1.
There is a subset of servers represented by an array servers of integers. They need to transfer the data to each other to be synchronized. Data transfer from one server to one it is directly connected to takes 1 unit of time. Starting from any server, find the minimum amount of time to transfer the data to all the other servers.
Complete the function getMinTime in the editor.
getMinTime takes the following arguments:
int total_servers: The number of servers in the systemint servers[n]: The servers to share the data with
Returns
int: The minimum time required to transfer the data on all the servers
🍊 A million thanks, spike 👍
1Example 1

2Example 2
3Example 3
Constraints
Limits and guarantees your solution can rely on.
1 ≤ total_servers ≤ 1091 ≤ n ≤ 1051 ≤ servers[i] ≤ n