AscalifyCodeLibs
Back to DSADSA → SortingQuestion 1 of 4
Sort Ascending
Sorting
Sort `nums` in ascending order and print the values space-separated.
Example 1:
Input: nums = [5,1,4,2,3]
Output: 1 2 3 4 5
Explanation: Sorted in non-decreasing order.
Example 2:
Input: nums = [1]
Output: 1
Example 3:
Input: nums = [3,3,1]
Output: 1 3 3
Code
Testcase / Output
Default testcase
nums = [5, 1, 4, 2, 3]
Expected output
1 2 3 4 5
Returned results
Click Run to execute your code against the testcase.