Jelly, 6 bytes
Œ!VṢ.ị
Explanation:
Œ!VṢ.ị Arguments: x
Œ! Permutations of x
V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
Ṣ Sort
.ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)
Jelly, 6 bytes
Œ!VṢ.ị
Explanation:
Œ!VṢ.ị Arguments: x
Œ! Permutations of x
V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
Ṣ Sort
.ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)