Company: Capital One_1july
Difficulty: medium
Minimum Operations to Stepwise Array Problem Description You are managing a row of building structures whose heights are given by an array structures , listed from left to right. You want the row to form a stepwise pattern : every structure must differ from each of its neighbours by exactly one unit, and the whole row must run in a single direction - either ascending (each structure is exactly one unit taller than the one before it) or descending (each structure is exactly one unit shorter than the one before it). The only change you may make is an operation , which adds one unit of height to a single structure. You can apply as many operations as you like, to any structures, in any order. You can never remove height. Print the minimum total number of operations needed to reach an ascending stepwise pattern or a descending stepwise pattern - whichever of the two is cheaper. Input Format (inferred - the source is a function-based task and does not state a standard input layout.) The fir