
Alice has an undirected tree with n nodes labeled from 0 to n - 1 . The tree is represented as a 2D integer array edges of length n - 1 where edges[i] = [a _i , b _i ] indicates that there is an edge between nodes a _i and b _i in the tree.
Alice wants Bob to find the root of the tree. She allows Bob to make several guesses about her tree. In one guess, he does the following:
Chooses two distinct integers u and v such that there exists an edge [u, v] in the tree.
He tells Alice that u is the parent of v in the tree.
Bob's guesses are represented by a 2D integer array guesses where guesses[j] = [u _j , v _j ] indicates Bob guessed u _j to be the parent of v _j .
Alice being lazy, does not reply to each of Bob's guesses, but just says that at least k of his guesses are true .
Given the 2D integer arrays edges , guesses and the integer k , return the number of possible nodes that can be the root of Alice's tree . If there is no such tree, return 0 .
edges.length == n - 12 <= n <= 10 ^51 <= guesses.length <= 10 ^50 <= a _i , b _i , u _j , v _j <= n - 1a _i != b _iu _j != v _jedges represents a valid tree.guesses[j] is an edge of the tree.guesses is unique.0 <= k <= guesses.length