[LeetCode/Python] 1385. Find the Distance Value Between Two Arrays

2025. 4. 23. 01:06

99클럽 코테 스터디 | 비기너 | 17일차


https://leetcode.com/problems/find-the-distance-value-between-two-arrays/description/

class Solution:
    def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int:

        count = 0

        for num1 in arr1:
            is_true = True
            for num2 in arr2:
                if abs(num1 - num2) <= d:
                    is_true = False
                    break
            if is_true:
                count += 1
        
        return count

BELATED ARTICLES

more