Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    1192 - Critical Connections in a Network.

    Hard

    There are n servers numbered from 0 to n - 1 connected by undirected server-to-server connections forming a network where <code>connectionsi = a<sub>i</sub>, b<sub>i</sub></code> represents a connection between servers <code>a<sub>i</sub></code> and <code>b<sub>i</sub></code>. Any server can reach other servers directly or indirectly through the network.

    A critical connection is a connection that, if removed, will make some servers unable to reach some other server.

    Return all critical connections in the network in any order.

    Example 1:

    Input: n = 4, connections = [0,1,1,2,2,0,1,3]

    Output: [1,3]

    Explanation: [3,1] is also accepted.

    Example 2:

    Input: n = 2, connections = [0,1]

    Output: [0,1]

    Constraints:

    • <code>2 <= n <= 10<sup>5</sup></code>

    • <code>n - 1 <= connections.length <= 10<sup>5</sup></code>

    • <code>0 <= a<sub>i</sub>, b<sub>i</sub><= n - 1</code>

    • <code>a<sub>i</sub> != b<sub>i</sub></code>

    • There are no repeated connections.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final List<List<Integer>> criticalConnections(Integer n, List<List<Integer>> connections)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait