Posts

Showing posts from March 18, 2021

Construction of New Buildings

Construction of New Buildings  PROBLEM STATEMENT : The program must accept a character of size R*C representing a city as the input. The matrix consists of asterisks and hyphens. Each asterisk represents a building and each hyphen represents a land. The government has planned to construct new buildings in the city based on the following condition.  - If a land is present in one of the four corners (top-left, top-right, bottom-left and bottom-right) of a building, then a new building is allowed to construct on that land.  The program must print the maximum number of new buildings that can be built based on the given conditions.  Boundary Condition(s):   2 <= R, C <= 50  Input Format:   The first line contains R and C separated by a space.  The next R lines, each contains C characters separated by a space.  Output Format:   The first line contains the maximum number of new buildings that can be built.  Example Input/Output 1...