Descending Alphanumeric Sorting
Start Timer
0:00:00
You are given an array of strings arr, where each string is in the format: <letters><number>. For example, you might see "a1", "b32", or "caba522".
Write a function called custom_sort(arr), which sorts the list of strings in two ways: first by the letter, in alphabetical order, and second by the numbers in descending order.
Note: The letters can only be lower case, and have length .
Example:
Input:
arr = ["b12", "a15", "b7", "a3", "c4", "c20"]
Output:
custom_sort(arr) -> '["a15", "a3", "b12", "b7", "c20", "c4"]'
.
.
.
.
.
.
.
.
.
Comments