Skyscrapers (easy version)
MediumRating 1500CodeforcesMonotonic Stack
Approach hintTry it first, then revealHide
Heights must rise to a single peak and then fall. Fix each plot as the peak and cap heights outward with a running minimum, O(n^2) overall; the hard version replaces this with monotonic stacks.