• + 0 comments

    Let's re-word this question : You're given a graph as input (in the form of pairs of vertices; every pair represents an edge).

    "Your task is to mark as small number of vertices as possible, such that, the maximum distance between two unmarked vertices is less than or equal to K."

    The above sentence says you need to mark (assume, mark = delete a vertex) so that the remaining number of vertices have atmost K length between them. In other words : find the minimum number of vertices you need to remove so that the remaining tree has path <= K between the vertices. Hint : Use floyd warshall algorithm.