Bright Data Interview Question

The first question was to sort, the second was to short code