## Introduction

Sorting means ordering of given elements based on their priority to that context. By default, it means increasing order. In computer science, __Sorting__ algorithms are very commonly used to solve DSA problems and implement algorithms. Sorting a number is also an interesting concept. We will see how both of these concepts will be used to solve this problem.

## Problem statement

You are given an array of integers. First, sort the integers individually and then sort the whole array.

Input:

*arr[ ]={41, 54, 23, 100, 31};*

Output:

*ans[ ]={1, 13, 14, 23, 45}*

**Explanation**

After sorting digits of the integers of the given array, resulted array will be

{14, 45, 23, 1, 13}. Now if we sort the resulting array, it will return {1, 13, 14, 23, 45}.

Note: Please try to solve the problem first and then see the solution below.