← All problemsSign in

Beautiful City

You are in the city’s municipal office and now have some construction work to do. The city has n towers arranged in a street. You know the height of each tower. But because the adjacent towers are of different heights, the city looks ugly. The corporation has asked you to beautify the city. The city can be made more beautiful by making the adjacent towers of the same height. Being a programmer, y

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