Sort Numbers Upward
Sorting is a basic way to prepare data for searching, comparing, or displaying. Given a list of integers nums, return a new list with all elements in ascending order. Keep duplicates in the result.
Примеры
Ввод
[5, 2, 3, 1]Вывод
[1, 2, 3, 5]Ввод
[]Вывод
[]Ввод
[3, 3, 1, 2, 2]Вывод
[1, 2, 2, 3, 3]Нужно реализовать
def sort_array(nums: list[int]) -> list[int]:
Теги
arraysorting
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónVisible tests
1
Input
[5,2,3,1]Expected
[1,2,3,5]2
Input
[]Expected
[]3
Input
[3,3,1,2,2]Expected
[1,2,2,3,3]4
Input
[-1,5,-3,0]Expected
[-3,-1,0,5]5
Input
[10]Expected
[10]6
Input
[3,3]Expected
[3,3]Focus radio
Paused · SomaFM · Fluid