My implementation: get the absolute values of differences between two neighbouring cells and then implement the sparse table to get the queries faster. Now using sliding window technique find the max length of window.
Context: I have pretty much tried to implement the solution given in the editorial. Any insight is highly helpful. Thanks.