Given an integer **N**, the task is to sort the digits in ascending order. Print the new number obtained after excluding leading zeroes.

**Examples:**

Input:N = 193202042Output:1222349Explanation:

Sorting all digits of the given number generates 001222349.

Final number obtained after removal of leading 0s is 1222349.

Input:N = 78291342023Output:1222334789

**Approach: **Follow the steps below to solve the problem:

- Convert the given integer to its equivalent string
- Sort the characters of the string using
**join()**and**sorted()****.** - Convert string to integer using type casting
- Print the integer obtained.

Below is the implementation of the above approach:

## Python3

`# Python program to ` `# implement the above approach ` ` ` `# Function to sort the digits ` `# present in the number n ` `def` `getSortedNumber(n): ` ` ` ` ` `# Convert to equivalent string ` ` ` `number ` `=` `str` `(n) ` ` ` ` ` `# Sort the string ` ` ` `number ` `=` `''.join(` `sorted` `(number)) ` ` ` ` ` `# Convert to equivalent integer ` ` ` `number ` `=` `int` `(number) ` ` ` ` ` `# Return the integer ` ` ` `return` `number ` ` ` ` ` `# Driver Code ` `n ` `=` `193202042` ` ` `print` `(getSortedNumber(n)) ` |

*chevron_right*

*filter_none*

**Output:**

1222349

**Time Complexity: **O(N*log(N))**Auxiliary Space:** O(N)

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.