Sort an Integer Array in Ascending Order
Problem statement
Return the values of values in nondecreasing order. Duplicate and negative values are allowed.
Function
sortAscending(values: int[]) → int[]Examples
Example 1
values = [1,2,4,3]return = [1,2,3,4]The out-of-order final pair is corrected.
Example 2
values = [3,1,3,2]return = [1,2,3,3]Equal values are retained.
Constraints
0 <= values.length <= 100000-1000000000 <= values[i] <= 1000000000