Practice Maximum 69 Number
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6).
Source: Maximum 69 Number on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = 9669
Output
9969
# Example 2
Input
num = 9996
Output
9999
# Example 3
Input
num = 9999
Output
9999
Constraints
1 <= num <= 10^4
num consists of only 6 and 9 digits.
Related LeetCode Problems
Practice more problems similar to Maximum 69 Number.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.