2367. Number of Arithmetic Triplets

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

Содержание

LeetCode problem 2367

class Solution:
    def arithmeticTriplets(self, nums: List[int], diff: int) -> int:
        vis = set(nums)
        return sum(x + diff in vis and x + diff * 2 in vis for x in nums)