1432. Max Difference You Can Get From Changing an Integer
You are given an integer num. You will apply the following steps to num two separate times: - Pick a digit x (0 <= x <= 9). - Pick another digit y (0 <= y <= 9). Note y can be equal to x. - Replace all the occurrences of x in the decimal representation of num by y. Let a and b be the two results from applying the operation to num independently. Return the max difference between a and b. Note
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start