A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same.

Given an array of numbers arr, return true if the array can be rearranged to form an arithmetic progression. Otherwise, return false.

&nbsp;
Example 1:

Input: arr = [3,5,1]
Output: true
Explanation: We can reorder the elements as [1,3,5] or [5,3,1] with differences 2 and -2 respectively, between each consecutive elements.


Example 2:

Input: arr = [1,2,4]
Output: false
Explanation: There is no way to reorder the elements to obtain an arithmetic progression.


&nbsp;
Constraints:


	2 &lt;= arr.length &lt;= 1000
	-106 &lt;= arr[i] &lt;= 106


class Solution:
    def canMakeArithmeticProgression(self, arr: List[int]) -> bool:
        arr.sort()
        check = arr[0] - arr[1]
        for i in range(len(arr)-1):
            if arr[i] - arr[i+1] != check:
                return False
        return True
class Solution {
    public boolean canMakeArithmeticProgression(int[] arr) {
        if(arr.length < 1)
            return false;
        Arrays.sort(arr);
        int diff = arr[1]-arr[0];
        for(int i=1;i<arr.length-1;i++){
            if(arr[i+1]-arr[i]!=diff){
                return false;
            }
        }
        return true;
    }
}
class Solution {
public:
    bool canMakeArithmeticProgression(vector<int>& arr) {
        sort(arr.begin() , arr.end());
        int diff = arr[1] - arr[0];
        for(int i=1;i<arr.size();i++){
            if(diff != arr[i] - arr[i-1]){
                return false;
            }
        }
        return true;
    }
};
var canMakeArithmeticProgression = function(arr) {
    arr.sort(function(a,b){return a-b});
    var dif = arr[1] - arr[0];
    for(var i=2;i<arr.length;i++){
        if(arr[i]-arr[i-1] !== dif){
            return false;
        }
    }
    return true;
};
Can Make Arithmetic Progression From Sequence