Company: Flipkart_13july
Difficulty: medium
Abhaneri Stepwell Reconstruction Problem Description The stepwell at Abhaneri has fallen out of use because its steps are disorganised and hard to climb. The villagers want to rebuild them. There are two flights of steps, one running East-West and one running North-South. Each flight has N steps, where N is odd, and the current height of every step is given. A rebuilt flight is acceptable only when all of the following hold: the middle step (position (N+1)/2, counting from 1) is the water level and is the lowest step; going from the middle step outwards to either end, each next step is exactly 1 unit higher than the one before it; there are equally many steps on the left of the middle step and on the right of it. In other words, if the rebuilt water level has height H, then the rebuilt flight is forced to be H+(N-1)/2, ..., H+2, H+1, H, H+1, H+2, ..., H+(N-1)/2 For symmetry, the two rebuilt flights must be identical - they must use the same H. Raising or lowering one step by 1 unit cou