Algorithm · Two Sigma · Hard
Requirements You are given a graph whose vertices represent people and whose edges indicate pairs of people who know one another. The graph is guaranteed to be a tree. Choose as many people as possible while ensuring that no two chosen people are connected by an edge. In graph terminology, return the size of the largest independent set of the tree. Implement: Follow-up: How would your approach change, or what can you conclude about the problem, when the input graph is not…
Checking your access…