values. Return it sorted in non-decreasing order.
The point is to implement the sorting yourself: do not use the built-in sort/sorted or their equivalents. Aim for O(n log n) time and as little extra memory as you can manage.values=[9, -4, 0, 7, -4] → [-4, -4, 0, 7, 9]
In ascending order: -4, -4, 0, 7, 9. Equal values all stay and simply end up next to each other.
values=[3, 2, 1] → [1, 2, 3]
The array was in descending order; sorted, it reads 1, 2, 3.
values=[42] → [42]
values=[9, -4, 0, 7, -4]
[-4, -4, 0, 7, 9]
Run checks the first 3 tests in your browser. Submit checks all 8 tests on the server, hidden ones included.