#C8483. Longest Contiguous Arithmetic Subarray
Longest Contiguous Arithmetic Subarray
Longest Contiguous Arithmetic Subarray
You are given an array of integers. Your task is to determine the length of the longest contiguous subarray that forms an arithmetic sequence.
An arithmetic sequence is defined as a sequence in which the difference between consecutive elements is constant. In other words, a sequence \(a_1, a_2, \dots, a_k\) is arithmetic if for some constant \(d\) it holds that \(a_i - a_{i-1} = d\) for every \(2 \le i \le k\).
The input is provided via standard input (stdin), and your program should output the result to standard output (stdout).
inputFormat
The first line of input contains a single integer \(n\) representing the number of elements in the array.
The second line contains \(n\) space-separated integers representing the array elements.
outputFormat
Output a single integer which is the length of the longest contiguous subarray that forms an arithmetic sequence.
Recall that an arithmetic sequence satisfies \(a_i - a_{i-1} = d\) for all \(i \ge 2\), where \(d\) is a constant.
## sample6
10 7 4 6 8 10
4