Problem 2873 · Easy

Maximum Value of an Ordered Triplet I

Track the largest prefix value and the largest difference seen so far, so each position can be used as the last index in one pass.

Open the interactive visualisation