2679. Count Distinct Numbers on Board
My accepted Python solution to LeetCode problem 2679, Count Distinct Numbers on Board, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17.1MB
- 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 0ms, memory 17.1MB, accepted 2026-01-01.
class Solution:
def distinctIntegers(self, n: int) -> int:
# For any x >= 2, x % (x-1) == 1
# So we'll eventually add all numbers from 2 to n
# Only exception: if n == 1, we can't add anything
return max(1, n - 1)