Company: ethos_20sep

Difficulty: medium

Problem Statement

Track Command Position Problem Description An organization has `n` staff members, where staff member 1 sits at the top of the hierarchy. The reporting structure forms a tree, and every staff member besides the top one reports to exactly one manager specified by the array `par`, where `par[i]` gives the manager of staff member `(i+1)` (0-based indexing). An announcement spreads through the hierarchy this way: A staff member passes the announcement to their direct reports in ascending order of index. Each of those reports then passes it further down their own reporting chain the same way. This continues until everyone under the originator has heard it. Given `q` queries, each query `(startNodeID, nodeID)` asks which staff member is the `nodeID`-th to hear the announcement when it originates from `startNodeID`. Return that staff member's id, or `-1` if fewer than `nodeID` people end up hearing it. Every query is independent of the others. Function Description Complete the function `getAns

More ethos_20sep OA questionsInterview experiences