LeetCode solutions

3581. The Two Sneaky Numbers of Digitville

My accepted Python solution to LeetCode problem 3581, The Two Sneaky Numbers of Digitville, running in 2ms.

  • Difficulty: Easy
  • Python
  • Runtime 2ms
  • Memory 17.3MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 2ms, memory 17.3MB, accepted 2026-01-01.

python
class Solution:
    def getSneakyNumbers(self, nums: List[int]) -> List[int]:
        from collections import Counter
        freq = Counter(nums)
        return [num for num, count in freq.items() if count == 2]

Source