Solve the question

Revision en1, by anshu2002, 2022-09-15 16:49:43
// there is a unrooted unweighted tree with n nodes numbered from 1 to n . You have to travel from 1 to n via some special nodes,
// so find the length of shortest path from 1 to n
// you can visit any node any number of times
// you have to visit special nodes atleast once
vector<int>edges = {{1,2},{1,3},{3,4},{3,5}};
vector<int>special_nodes = {2,4};
// ans : 6 (1->2->1->3->4->3->5)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English anshu2002 2022-09-15 16:49:43 431 Initial revision (published)