How to approch this problem.... problem link is given below

What we need is a subtree that has even number of vertices and as we get it we can remove the edge that connects it to the remaining of the tree so that we are left with a subtree of even vertices and the remaining tree with vertices N -(No. of vertices in the subtree removed). Now we are left with the same problem again with remaining tree having even number of vertices because remember that N is even so even-even=even, so we have to repeat this algorithm until the remaining tree cannot be decomposed further in the above manner. To maximize the number of subtree remove(which is equal to the number of edges removed) we have to remove subtree which cannot be decomposed in the above manner.

To do this we can traverse the tree using dfs and the dfs function should return the number of vertices in the subtree of which the current node is the root. If a node gets in return an even number of vertices from one of it child then the edge from that node to its child should be removed and if the number is odd add it to the number of vertices that the subtree will have if the current node is the root of it.