Task
Given an unsorted list of integers, order it in such a way that the absolute difference of every two adjacent elements will always be equal to 1:
\$|dx| = 1\$
There will be guaranteed one or more solutions. You may choose any one of the solutions as your output. The list's minimal length is 2.
Your task is to output the list in the order that satisfies the condition of this challenge.
Rules
This is code-golf. Standard i/o. Standard loopholes.
Test cases
[1, 2] -> [1, 2] or [2, 1]
[4, 5, 5, 5, 4] -> [5, 4, 5, 4, 5]
[1, 3, 2, 4, 5] -> [1, 2, 3, 4, 5] or [5, 4, 3, 2, 1]
[3, 0, 1, 1, 2, 4] -> [1, 0, 1, 2, 3, 4] or [4, 3, 2, 1, 0, 1]
[4, 2, 3, 4, 4, 5, 5] -> [2, 3, 4, 5, 4, 5, 4 ] or [4, 5, 4, 5, 4, 3, 2]
[1, 7, 5, 2, 6, 4, 4, 3, 3] -> [1, 2, 3, 4, 3, 4, 5, 6, 7] or the reverse of it
[6,10,2,12,13,5,7,1,14,9,2,1,4,10,13,11,11,12,8,3,9]
-> [11,12,13,14,13,12,11,10,9,10,9,8,7,6,5,4,3,2,1,2,1] or the reverse of it
