Problems > Longest Arithmetic Stretch > Editorial

Longest Arithmetic Stretch — Solution & Editorial

Back to the Problem

Extend the current run while the difference matches the previous one, else reset to 2.

Complexity: O(N)