Alternate Sort

Published by Mubashir Hassan in

Write a function that sorts a given array in an aletrnative fashion. The result should be an array sorted in ascending order (number then letter). Arrays will contain equal amounts of integer numbers and single characters.

Examples

alternate_sort(["a", "b", "c", 1, 2, 3]) ➞ [1, "a", 2, "b", 3, "c"]

alternate_sort([-2, "f", "A", 0, 100, "z"]) ➞ [-2, "A", 0, "f", 100, "z"]

alternate_sort(["X", 15, 12, 18, "Y", "Z"]) ➞ [12, "X", 15, "Y", 18, "Z"]

Notes

N/A

Watch a quick demo on how Edabit works.