# Amazon test Rejected

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.

Input

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,

Output

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.

Constraints
0 <= numOfServers <=10^5
0 <= num Connections <= 10^5
1 <= connections[i][j] <= numofServers
0 <=i < numofConnections
0 <= j< 2

Example

Input:

numofServers = 5
numofConnections = 5
connections-[[1,2], [1,3], [3, 4], [1,4], [4, 5]]

Output:
[[1,2], [4, 5]]

This is the code which i wrote and only 3/16 test cases passed only

https://pastebin.ubuntu.com/p/mZXWVsP8Zx/

and same code when i submitted on leedcode, all the test cases passed

link is not working pls check.

The output given for the test case is [u, v] where u < v and vice-versa. It could be possible that your code was storing [u, v] where u > v which resulted in the WA in the test cases. I am not 100% sure, but this could be a reason.

I Submitted Same code as my leetcode submission i got only 12/16 testcases.

same problem came to my amazon online test . and you also did what i did but in my case 6/16 test cases are passing
basically my friends all test cases are passing , here is some difference with his code to my code

1. he uses array instead of vector
2. trust me , rest all code is same . just dont use vector in this question

Problem can be
1)shitty amcat platform

In my openion this problem should be removed .

Give the leetcode problem name or link , so that we can better help u .

Here is the link to the exact same question.

Bhai, apply kaise kiya Amazon me?

The same thing happened to me. I changed all the global variables and arrays to local ones and all the test cases passed.

1 Like