Company: Texas

Difficulty: medium

Problem Statement

Sequential Promise Resolution Each positive value represents a promise that resolves to that value; `0` represents a rejected promise. Process promise indices in the given 1-based order. Print resolved values, one per line. When a rejected promise is encountered, print `Error Thrown` and stop. Input Format The first line contains `n`, followed by `n` promise values. The next line contains `n`, followed by `n` indices forming a permutation of `1..n`. Output Format Print the required sequence. Constraints `1 <= n <= 100`; at most one value is zero.

More Texas OA questionsInterview experiences