Question: from typing import List def insert(lst: List[int], v: int) -> None: Insert v into lst just before the rightmost item greater than v, or at

from typing import List

def insert(lst: List[int], v: int) -> None:

"""Insert v into lst just before the rightmost item greater than v, or at

index 0 if no items are greater than v.

>>> my_list = [3, 10, 4, 2]

>>> insert(my_list, 5)

>>> my_list

[3, 5, 10, 4, 2]

>>> my_list = [5, 4, 2, 10]

>>> insert(my_list, 20)

>>> my_list

[20, 5, 4, 2, 10]

"""

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!