Function to find the count of pairs such that the minimum distance between them is equal to the difference between distance of the nodes from root node
def countPairs ( edges ) : NEW_LINE INDENT global adj NEW_LINE for i in range ( len ( edges ) ) : NEW_LINE INDENT u = edges [ i ] [ 0 ] NEW_LINE v = edges [ i ] [ 1 ] NEW_LINE DEDENT DEDENT