Drop the Lowest Value
Imagine a list of scores where you need to remove one worst result and keep everything else as it was. Write remove_smallest, which removes only the first occurrence of the smallest number from the list numbers. The order of the remaining numbers must stay the same, and an empty list should return an empty list.
Примеры
Ввод
[1, 2, 3, 4, 5]Вывод
[2, 3, 4, 5]Ввод
[5, 3, 2, 1, 4]Вывод
[5, 3, 2, 4]Ввод
[2, 2, 1, 2, 1]Вывод
[2, 2, 2, 1]Нужно реализовать
def remove_smallest(numbers: list[int]) -> list[int]:
Теги
array
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
EntrarVisible tests
1
Input
[1,2,3,4,5]Expected
[2,3,4,5]2
Input
[5,3,2,1,4]Expected
[5,3,2,4]3
Input
[2,2,1,2,1]Expected
[2,2,2,1]4
Input
[]Expected
[]5
Input
[1]Expected
[]6
Input
[6,4,3,2,5]Expected
[6,4,3,5]Focus radio
Paused · SomaFM · Fluid