Company: Barclays
Difficulty: medium
Beautiful Houses The current selected programming language is C++14. We emphasize the submission of a fully working code over partially correct but efficient code. Once submitted, you cannot review this problem again. You can use cout to debug your code. The cout may not work in case of syntax/runtime error. The version of GCC being used is 5.5.0. The city authorities are examining the houses in a residential area for a city planning scheme. The area is depicted in an aerial view and divided into a N × M grid. If a grid cell contains some part of a house roof, it is assigned a value 1; if not, then the cell represents a vacant plot and is assigned the value 0. Clusters of adjacent grid cells with value 1 represent a single house. Diagonally placed grids with value 1 do not represent a single house. \"Beautiful house\" is a special kind of house that is surrounded by vacant plots on all sides: horizontally, vertically and diagonally. You may assume that all four boundaries of the given