Company: Joveo_10_feb
Difficulty: medium
Tree Relation Problem Description Given a Tree with N nodes rooted at node 1. We need to answer Q queries of the type: P C : Return 1 if node C is present in the subtree of node P , else 0. Note: Every node is considered to be present in its own subtree. Example If N = 5, edges = {{1,2}, {2,3}, {1,4}, {1,5}}, and Q = 2. Query 1: 1 3 . The answer is 1, as node 3 is present in the subtree of node 1 (path: 1 -> 2 -> 3). Query 2: 2 5 . The answer is 0, because node 5 is not present in the subtree of node 2. Function Description Complete the solve function provided in the editor. This function takes the following 4 parameters and returns a vector of integers representing the answers to the Q queries. N : An integer representing the number of nodes in the tree. edge : A 2D vector of integers where each inner vector [u, v] represents an edge between node u and node v. Q : An integer representing the number of queries. query : A 2D vector of integers where each inner vector [P, C] represents a