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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 35ms, memory 17.7MB, accepted 2025-12-29.
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