Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 405 Bytes

1502.-can-make-arithmetic-progression-from-sequence.md

File metadata and controls

17 lines (13 loc) · 405 Bytes

1502. Can Make Arithmetic Progression From Sequence

class Solution:
    def canMakeArithmeticProgression(self, arr: List[int]) -> bool:
        if len(arr) <=2 :
            return True
        arr.sort()
        a = arr[1] - arr[0]
        for i in range(2,len(arr)):
            if arr[i] - arr[i-1] != a:
                return False
            
        return True