LeetCode solutions

2215. Finding 3-Digit Even Numbers

My accepted Python solution to LeetCode problem 2215, Finding 3-Digit Even Numbers, running in 35ms.

  • Difficulty: Easy
  • Python
  • Runtime 35ms
  • Memory 17.7MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 35ms, memory 17.7MB, accepted 2025-12-29.

python
class Solution:
    def findEvenNumbers(self, digits: List[int]) -> List[int]:
        from collections import Counter
        count = Counter(digits)
        result = []
        
        for num in range(100, 1000, 2):  # even numbers from 100 to 998
            d1, d2, d3 = num // 100, (num // 10) % 10, num % 10
            needed = Counter([d1, d2, d3])
            
            valid = True
            for d, c in needed.items():
                if count[d] < c:
                    valid = False
                    break
            
            if valid:
                result.append(num)
        
        return result

Source