Ankit Choubey def replace(l): for i in range(len(l)): m=0 Nl=[-1] for j in range(i,len(l)): if l[j]>m: m=l[j] l[i]=m l.pop(0) l+=Nl print(l) l=list(map(int,input().split())) n=int(input()) replace(l) Log in to Reply
def replace(l):
for i in range(len(l)):
m=0
Nl=[-1]
for j in range(i,len(l)):
if l[j]>m:
m=l[j]
l[i]=m
l.pop(0)
l+=Nl
print(l)
l=list(map(int,input().split()))
n=int(input())
replace(l)