Problem 4067 · Medium

Longest Subarray With Restricted Pair Sums

Grow a window while no three distinct positions form a pair sum, and when a new element breaks that, drop elements from the left.

Open the interactive visualisation