Remove the Smallest
You can picture a stack as a pile: the bottom is on the left, and the top is on the right. Given a list stack, find the minimum value and remove only its first occurrence when reading from left to right. Keep all other elements in their original order.
Примеры
Ввод
[2, 8, 3, -6, 7, 3]Вывод
[2, 8, 3, 7, 3]Ввод
[4, 8, 3, 7, 3]Вывод
[4, 8, 7, 3]Ввод
[1, 2, 3]Вывод
[2, 3]Нужно реализовать
def remove_min(stack: list[int]) -> list[int]:
Теги
stack
Συνδεθείτε για να δείτε το ιστορικό υποβολών
ΣύνδεσηΣυνδεθείτε για να χρησιμοποιήσετε τον AI Mentor
ΣύνδεσηVisible tests
1
Input
[2,8,3,-6,7,3]Expected
[2,8,3,7,3]2
Input
[4,8,3,7,3]Expected
[4,8,7,3]3
Input
[1,2,3]Expected
[2,3]4
Input
[5]Expected
[]5
Input
[-6,2,3,3,7,8]Expected
[2,3,3,7,8]6
Input
[3,7,-6,3,8,2]Expected
[3,7,3,8,2]Focus radio
Paused · SomaFM · Fluid