Company: Flipkart_13july
Difficulty: medium
Abhaneri Stepwell Reconstruction Problem Description The Abhaneri village stepwell has not been in use for a while. Stepwells are wells or ponds in which water is reached by descending a set of steps to the water level. The stepwell in Abhaneri went out of use because the steps were very disorganised and people found it difficult to ascend/descend them. To correct this situation, the villagers decide to reconstruct the steps such that the heights of adjacent steps differ exactly by 1 unit. The steps are in two directions, East-West and North-South. For symmetry, the villagers decide that the final steps in both directions must be identical. In each direction, the steps should be strictly descending, reach the water level and then be strictly ascending. The lowest step, which is the water level, must have an equal number of steps to the left and to the right of it. The existing N steps can be modified by reducing or increasing the height of a step by 1 unit is counted as one change. Sin