#K77687. Can Form Arithmetic Progression
Can Form Arithmetic Progression
Can Form Arithmetic Progression
Given an array of integers, determine if it can be rearranged to form an arithmetic progression. An arithmetic progression is a sequence where the difference between any two consecutive elements is constant. In mathematical terms, an arithmetic progression is defined as: (a,, a+d,, a+2d,,\dots). Note that if the array has fewer than 2 elements, the answer is considered False.
inputFormat
The first line contains an integer (n) which denotes the number of elements. The second line contains (n) space-separated integers representing the elements of the array.
outputFormat
Output a single line: either 'True' if the array can be rearranged to form an arithmetic progression, or 'False' otherwise.## sample
3
3 5 1
True
</p>