← All problemsSign in

Tree Limit Exceeded

There are $n$ planets in a sequence where each planet has trees of different heights. The planets are numbered from 1 to $n$. Thinos doesn't likes trees and destroys the largest tree that he sees. Due to limited vision, Thinos can only see the trees present on a given range of planets $l$ to $r$ where $1 \leq l \leq r \leq n$ and destroys a single tree that has the greatest height among all the tr

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