LeetCode-1502/220325
517 ワード
https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence/
Python
class Solution:
def canMakeArithmeticProgression(self, arr: List[int]) -> bool:
s = sorted(arr)
d = s[0] - s[1]
for i in range (2, len(s)):
if d != s[i-1] - s[i]:
return False
return True
Reference
この問題について(LeetCode-1502/220325), 我々は、より多くの情報をここで見つけました https://velog.io/@iyong829/LeetCode-1502-220325テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol