Problem · String
Error Digit Range
Learn this problemProblem statement
A faulty translator chooses one input digit and consistently replaces every occurrence with one output digit. The output must keep the same number of significant digits. The chosen input digit may be absent, which leaves the number unchanged. Return the difference between the maximum and minimum values that can be produced.
Function
findRange(num: int) → longExamples
Example 1
num = 111return = 888The maximum is 999 and the minimum is the unchanged 111.
Example 2
num = 10018return = 80088The maximum 90098 replaces 1 with 9; the minimum 10010 replaces 8 with 0.
Constraints
1 <= num <= 10^9- The first output digit cannot be zero.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024