Problem Statement | |||||||||||||
It is a common mistake to sort numbers as strings. For example, a sorted sequence like {"1", "174", "23", "578", "71", "9"} is not correctly sorted if its elements are interpreted as numbers rather than strings. You will be given a String[] sequence that is sorted in non-descending order using string comparison. Return this sequence sorted in non-descending order using numerical comparison instead. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | sequence will contain between 2 and 50 elements inclusive. | ||||||||||||
- | Each element of sequence will contain between 1 and 9 characters inclusive. | ||||||||||||
- | Each element of sequence will consist of only digits ('0'-'9'). | ||||||||||||
- | Each element of sequence will not start with a '0' digit. | ||||||||||||
- | sequence will be ordered lexicographically. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|