a tree undirected graph exactly simple path pair vertex we set simple path kvalid vertex tree belong path include endpoint path consist exactly k verticesyou give tree n vertex for k 1 n inclusive find maximum possible size kvalid set simple path