Difficulty
Easy
Language
Python
Solution 1 - Sort and Check Differences
After sorting, all adjacent differences must match.
""" 1502.1 - Can Make Arithmetic Progression From Sequence - Solution 1 - Sort """
from typing import List
class Solution:
def canMakeArithmeticProgression(self, arr: List[int]) -> bool:
arr.sort()
d = arr[1] - arr[0]
for i in range(2, len(arr)):
if arr[i] - arr[i-1] != d:
return False
return True