Recently, I have been through the aptitude process of Amazon India. There was a question that has be stated below :
Amazon wants to pilot hardware replacements in Data Center AMZN525, to Increase the reliability of their network. AMZN525 has a “connected” network of data servers, I.e. every server can communicate with the rest of the network. The data servers are connected by point-to-point cables to establish “critical” or “non-critical” connections, A connection is considered “critical” if its removal results in a disconnected network of servers. Amazon wants to significantly increase the reliability of its Data Centers by replacing the critical connections with far more reliable cables.
Write a method that returns the critical connections in AMZN525.
The Input to the function/method consists of three arguments -
numofServers, an Integer representing the number of servers in the data center: numofConnections, an integer representing the number of connections between the servers;
connections, a list of pairs of integers representing the connections between two servers,
Return a list of pairs of integers representing the critical connections. If there are no critical connections, return a list with empty pair - not just an empty list.
0 <= numOfServers <=10^5
0 <= num Connections <= 10^5
1 <= connections[i][j] <= numofServers
0 <=i < numofConnections
0 <= j< 2
numofServers = 5
numofConnections = 5
connections-[[1,2], [1,3], [3, 4], [1,4], [4, 5]]
[[1,2], [4, 5]]
This is the code which i wrote and only 3/16 test cases passed only
and same code when i submitted on leedcode, all the test cases passed