The same dashboard also flags servers that are single points of failure. Servers are numbered 0 to n - 1, and cables[i] = [a, b] is a two-way cable.
A critical server is one whose failure (removing it and its cables) leaves some pair of the remaining servers that were connected unable to reach each other. Write criticalServers(n, cables) that returns the critical servers sorted ascending.
Input: n = 5, cables = [[0,1],[1,2],[2,0],[1,3],[3,4]] Output: [1,3]
Without server 1, server 3 loses its link to the triangle. Without server 3, server 4 is cut off.
Input: n = 3, cables = [[0,1],[1,2],[2,0]] Output: []
In a triangle, the other two servers still share a cable when any one fails.
1 <= n <= 100000 <= cables.length <= 500000 <= a, b < n, a !== bRun tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #478 Servers Whose Failure Splits the Network. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.