LeetCode solutions

2752. Sum Multiples

My accepted Python solution to LeetCode problem 2752, Sum Multiples, running in 25ms.

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

Read the problem on LeetCode View on GitHub

Python

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

python
class Solution:
    def sumOfMultiples(self, n: int) -> int:
        return sum(i for i in range(1, n + 1) if i % 3 == 0 or i % 5 == 0 or i % 7 == 0)

Source