HackerRank Solution: Even Tree | HackerRank Tutorials
You are given a tree (a simple connected graph with no cycles). The tree has N nodes numbered from 1 to N.
Find the maximum number of edges you can remove from the tree to get a forest such that each connected component of the forest contains an even number of vertices.
Input Format:
The first line of input contains two integers N and M. N is the number of vertices, and M is the number of edges.
The next M lines contain two integers ui and vi which specifies an edge of the tree.
Read full article from HackerRank Solution: Even Tree | HackerRank Tutorials
No comments:
Post a Comment