Check Arithmetic Sequence
easy
1. You are given an array(arr) of integers. 2. You have to find if the elements of the given array can be arranged to form an arithmetic progression. 3. Arithmetic progression is defined as a sequence of numbers where the difference between any two consecutive numbers is the same. Note -> Try to solve this in linear time complexity.
Constraints
1 <= N <= 10^6 1 <= arr[i] <= 10^3
Format
Input
A number N arr1 arr2.. N numbers
Output
true/false
Example
Sample Input
3
3 5 1
Sample Output
true
Question Video