Tap here to switch tabs
Problem
Submissions

Problem: Smallest Value of the Rearranged Number

Smallest Value of the Rearranged Number asks you to rearrange all digits of an integer, including negative values, to return the lowest possible number without leading zeros, unless the input is zero.

Statement

You are given an integer num. Rearrange the digits of num such that its numerical value is minimized.

The rearranged integer must not contain any leading zeros, unless num itself is equal to 00.

Return the rearranged integer with the smallest value.

Constraints:

  • −1015≤-10^{15} \leq num ≤1015\leq 10^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Value of the Rearranged Number

Smallest Value of the Rearranged Number asks you to rearrange all digits of an integer, including negative values, to return the lowest possible number without leading zeros, unless the input is zero.

Statement

You are given an integer num. Rearrange the digits of num such that its numerical value is minimized.

The rearranged integer must not contain any leading zeros, unless num itself is equal to 00.

Return the rearranged integer with the smallest value.

Constraints:

  • −1015≤-10^{15} \leq num ≤1015\leq 10^{15}