Problem 574. Sort numbers by outside digits
Sort the array so that they are sorted as if their value was a 5 digit number made from the first three and last two digits of the value, irrespective of the middle digits.
For example: the array is: [166552, 12389245, 88234, 74123245], it the return would be sorted as if the numbers were [16652, 12345, 88234, 74145], and therefore the return array would be: [12389245, 166552, 74123245, 88234].
The numbers are all integers >= 10000, with no leading 0's.
Solution Stats
Problem Comments
-
1 Comment
Additional test cases have been added.
Solution Comments
Show commentsProblem Recent Solvers152
Suggested Problems
-
Select every other element of a vector
34708 Solvers
-
324 Solvers
-
Generate N equally spaced intervals between -L and L
897 Solvers
-
191 Solvers
-
Generate a random matrix A of (1,-1)
364 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!