Company: Ibm_1aug
Difficulty: medium
Question 10 Problem Description You are given a row of buildings , all standing next to each other in a straight line. Each building has a width of 1 unit and a given height . You want to install a rectangular advertisement billboard that spans one or more consecutive buildings . However, the height of the billboard cannot exceed the shortest building in the range it covers. Your goal is to find the largest possible billboard (areawise) can be installed. Input Format: The first line contains an integer, represents number of buildings. Each of the next n lines contains an integer building height. Output Format: An integer representing maximum area of the rectangle (billboard) that can fit between the buildings. Examples Example 1: Input: 6 2 1 5 6 2 3 Output: 10 Explanation: The largest rectangle can be formed by the buildings of height 5 and 6 (width 2, height 5): 5 x 2 = 10