Problem 2898 · Medium

Maximum Linear Stock Score

Group the days by price minus index. Days in one group form a linear run, so the largest group total is the answer.

Open the interactive visualisation