Problems > Arithmetic or Not > Editorial

Arithmetic or Not — Solution & Editorial

Back to the Problem

Fix d = a2−a1 and verify every adjacent difference equals d. Length 1 or 2 is always arithmetic.

Complexity: O(N)