Skip to main content

Contest 1 — A: Desert Mirage

Challenge on lesson: Contest 1-A: Desert Mirage

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Standing in the desert, you see a row of n heat shimmer waves; wave i has height h[i]. A wave is VISIBLE from the left if it is strictly taller than every wave before it. Count the visible waves. **Input:** Line 1: n (1 <= n <= 200000). Line 2: n integers (|h[i]| <= 10^9). **Output:** One integer — the count. **Example:** 5 / 3 1 4 1 5 -> 3 (3, 4, 5).

Back to lesson: Contest 1-A: Desert Mirage