LeetCode solutions

3799. Unique 3-Digit Even Numbers

My accepted Python solution to LeetCode problem 3799, Unique 3-Digit Even Numbers, running in 16ms.

  • Difficulty: Easy
  • Python
  • Runtime 16ms
  • Memory 17.1MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 16ms, memory 17.1MB, accepted 2025-12-31.

python
class Solution:
    def totalNumbers(self, digits: List[int]) -> int:
        from itertools import permutations
        result = set()
        for perm in permutations(digits, 3):
            if perm[0] != 0 and perm[2] % 2 == 0:  # no leading zero, last digit even
                num = perm[0] * 100 + perm[1] * 10 + perm[2]
                result.add(num)
        return len(result)

Source