LeetCode solutions

2694. Find the Maximum Divisibility Score

My accepted Python solution to LeetCode problem 2694, Find the Maximum Divisibility Score, running in 2493ms.

  • Difficulty: Easy
  • Python
  • Runtime 2493ms
  • Memory 17.4MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 2493ms, memory 17.4MB, accepted 2025-12-31.

python
class Solution:
    def maxDivScore(self, nums: List[int], divisors: List[int]) -> int:
        max_score = -1
        result = min(divisors)
        for d in divisors:
            score = sum(1 for n in nums if n % d == 0)
            if score > max_score or (score == max_score and d < result):
                max_score = score
                result = d
        return result

Source