Company: ethos_20sep

Difficulty: medium

Problem Statement

Track Command Position Problem Description A network contains `n` nodes, where node 1 is the root node. The network structure is represented as a tree, with each node (except the root) having exactly one parent specified by the array `par`, where `par[i]` represents the parent of node `(i+1)` (0-based indexing). Commands propagate through the network as follows: A node sends the command to its direct child nodes in ascending order of their indices. Each child node propagates the command to its subtree using the same process. The propagation stops when all nodes in the subtree have received the command. Given `q` queries, each query `(startNodeID, nodeID)` asks for the `nodeID`-th node in the sequence of command propagation starting from node `startNodeID`. Return the `nodeID`-th node or `-1` if fewer than `nodeID` nodes receive the command. Each query is processed independently. Function Description Complete the function `getAnswersToQueries` in the editor with the following parameters

More ethos_20sep OA questionsInterview experiences