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
Jelentkezz be a beküldési előzmények megtekintéséhez
BejelentkezésJelentkezz be az MI-mentor használatához
BejelentkezésTests12
Visible tests
Rejtett teszt 7
Rejtett teszt 8
Rejtett teszt 9
Rejtett teszt 10
Rejtett teszt 11
Rejtett teszt 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid