Practice · 2 of 5
Waiting for a Taller One
CHALLENGE
Difficulty: advanced+25 XP
**Bài toán.** For each of n towers, print the height of the first tower strictly taller to its right, or −1 if none exists. **Constraints:** 1 ≤ n ≤ 200000; 1 ≤ a[i] ≤ 10^9. **Output:** n lines. The intended solution is linear; nested scanning times out.
Press Submit to check your solution.
Back to lesson: Practice: Observation Drill — Five Hidden Structures