A bridge is an edge that makes the graph disconnected when deleted. My claim is that not only the graph becomes disconnected, but nodes 1 and n become disconnected in particular. Let's prove it by assuming it's false and reaching a contradiction. ...
vector<int> eventualSafeNodes(vector<vector<int>>&graph) { vector<int> indegree(graph.size(),0); vector<int> outdegree(graph.size(),0); unordered_map<int,vector<int>>parent;for(inti=0; i<graph.size(); i++){for(intj=0; j<graph[i].size(); j++){ indegree[graph[i][j]]++;...