Unique digit count
Practice
3.7 (3 votes)
Algorithms
Bitmask
Dynamic programming
Digitdp
4d dynamic programming
Problem
57% Success 206 Attempts 30 Points 2s Time Limit 254MB Memory 1024 KB Max Code
You are given a range \(L\) to \(R\). You are required to find the number of \(k\)-special numbers in this range (inclusive). A \(k\)-special number is a number that has exactly \(k\) unique digits.
For example:
- 26 is a 2-special number. Digits 2 and 6 are unique.
- 6643 is a 3-special number. Digits 6, 4, and 3 are unique.
Constraints
\(1 \le T \le 10\\
1 \le L,\ R \le 10^{18}\\
1 \le k \le 7\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
Tags:
Linear AlgebraMediumMathematics
Points:30
Tags:
Medium
Points:30
3 votes
Tags:
MediumAlgorithmsMathematicsOpenApprovedGame Theory
Editorial