Practice Smallest Value of the Rearranged 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 an integer num. Rearrange the digits of num such that its value is minimized and it does not contain any leading zeros. Return the rearranged number with minimal value. Note that the sign of the number does not change after rearranging the digits.
Source: Smallest Value of the Rearranged Number on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = 310
Output
103
# Example 2
Input
num = -7605
Output
-7650
Constraints
-10^15 <= num <= 10^15
Related LeetCode Problems
Practice more problems similar to Smallest Value of the Rearranged Number.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.