This function prints all nodes that are distance k from a leaf node path [ ] - . Store ancestors of a node visited [ ] - . Stores true if a node is printed as output . A node may be k distance away from many leaves , we want to print it once
def kDistantFromLeafUtil ( node , path , visited , pathLen , k ) : NEW_LINE