4

# Make Maximum Number

Difficulty: EASY
Avg. time to solve
18 min
Success Rate
85%

Problem Statement
Suggest Edit

#### You just need to print the maximum Integer that can be formed

##### Input format :
``````Line 1: Linked list elements of length n (separated by space and terminated by -1)
``````
##### Output format :
``````The maximum Number formed using the digits present in the linked list.
``````
##### Note:
``````You do not need to print anything, it has already been taken care of. Just implement the given function.
``````
##### Constraints:
``````1 <= N  <= 10^6
0 <= data <= 9
where N  is the size of linked list and data is the value of a node in the linked list.
Time Limit: 1sec
``````
##### Sample Input 1 :
`````` 1 2 2 0 9 -1
``````
##### Sample Output 1 :
`````` 92210
``````
##### Explanation of The Sample Input1:
``````The digits that are present in the linked list are : (1, 2, 2, 0, 9 )
So the answer is the maximum of all the numbers that are formed using these digits is 92210.
``````
##### Sample Input 2 :
``````1 0 0 0 3 -1
``````
##### Sample Output 2 :
``````31000
``````
##### Explanation of The Sample Input 2 :
``````The maximum of all the numbers formed using the digits present in the linked list i.e.(1, 0, 0, 0, 3) is 31000.
``````