← All problemsSign in

Brick Comparisions

CodeChefRating 625Open on judge ↗

Chef has $N$ bricks with him, numbered $1$ to $N$, with the $i$-th one being of size $A_i$. He will perform the following process: - First, he picks up the brick numbered $1$. - Next, he looks at the other bricks in the order $2, 3, \ldots, N$, and if he finds this brick has a **strictly larger** size than the brick in his hand, he drops his current brick and picks this up instead. Your task is

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start