Education + Jobs Hiring Website - 2025
0 like 0 dislike
45 views

imageimageimage

ago in Online Assessments by Expert (137,260 points) | 45 views

1 Answer

0 like 0 dislike
Kumar K student cracks Amazon SDE Internship Offer - https://www.linkedin.com/posts/kumark1_amazon-student-activity-7426656018249703424-Bvyi?utm_source=share&utm_medium=member_desktop&rcm=ACoAADB1e44BA43UYjFx2BwtGFrtyTJFuENef5c

 

 

Pre-requisite :- https://videsiqna.in -> (Do the graph part of it)

 

 

Understanding :- Given a disconnected graph(edges are bidirectional) -> find the index of node such that if you remove that particular node the final number of green nodes is minimum;

 

Note :-> Once removal procedure is done then spreading procedure is completed -> to count the final number of green nodes; Green color nodes will spread to all the nodes they are directly connected to and they will also become green;  

 

-> If multiple nodes can give the same minimum answer -> then print the node with minimum index among them;

 

-> By doing BFS/DFS -> you can identify multiple different components in the graph -> if any component has even a single green node then it is confirmed that in the end -> THAT FULL COMPONENT WILL BE GREEN;

 

Logic :-> https://ideone.com/u4jKK8
ago by Expert (137,260 points)