1192. Critical Connections in a Network Hard
1/**
2 * [1192] Critical Connections in a Network
3 *
4 * There are n servers numbered from 0 to n - 1 connected by undirected server-to-server connections forming a network where connections[i] = [ai, bi] represents a connection between servers ai and bi. Any server can reach other servers directly or indirectly through the network.
5 * A critical connection is a connection that, if removed, will make some servers unable to reach some other server.
6 * Return all critical connections in the network in any order.
7 *
8 * Example 1:
9 * <img alt="" src="https://assets.leetcode.com/uploads/2019/09/03/1537_ex1_2.png" style="width: 198px; height: 248px;" />
10 * Input: n = 4, connections = [[0,1],[1,2],[2,0],[1,3]]
11 * Output: [[1,3]]
12 * Explanation: [[3,1]] is also accepted.
13 *
14 * Example 2:
15 *
16 * Input: n = 2, connections = [[0,1]]
17 * Output: [[0,1]]
18 *
19 *
20 * Constraints:
21 *
22 * 2 <= n <= 10^5
23 * n - 1 <= connections.length <= 10^5
24 * 0 <= ai, bi <= n - 1
25 * ai != bi
26 * There are no repeated connections.
27 *
28 */
29pub struct Solution {}
30
31// problem: https://leetcode.com/problems/critical-connections-in-a-network/
32// discuss: https://leetcode.com/problems/critical-connections-in-a-network/discuss/?currentPage=1&orderBy=most_votes&query=
33
34// submission codes start here
35
36impl Solution {
37 pub fn critical_connections(n: i32, connections: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
38 vec![]
39 }
40}
41
42// submission codes end
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[test]
49 fn test_1192() {
50 }
51}
52
Back
© 2025 bowen.ge All Rights Reserved.