2229. Check if an Array Is Consecutive

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2229

class Solution:
    def isConsecutive(self, nums: List[int]) -> bool:
        mi, mx = min(nums), max(nums)
        n = len(nums)
        return len(set(nums)) == n and mx == mi + n - 1