← All problemsSign in

Bob The Builder

Bob, the builder is working on a city project, where the city has n adjacent buildings, numbered from **0** to **n-1**. Each building is made by stacking 1x1 blocks. We are given an array of **n** elements, where ith element represents the height of the ith building. Bob can *rebuild and modify* the height of any building that he is currently on by rearranging the existing blocks or any additio

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