Python Program to replace every element with the greatest element on right side
Python Program to get list size n and n elements of list, replace every elements with the greatest element located in right side.
Sample Input 1:
5 5 7 9 3 1
Sample Output 1:
9 9 3 3 1
Program or Solution
l=list(map(int,input("Enter numbers:").split(" ")))
for i in range(0,len(l)-1):
max1=l[i+1]
for j in range(i+2,len(l)):
if(l[j]>max1):
ind=j
max1=l[j]
l[i]=l[ind]
print(l)
Program Explanation
visit each location in list find the greatest element (max1)next to the location using Store the max1 in current location by l[i] = max1Comments
ubaTaeCJ
-1 OR 2+697-697-1=0+0+0+1 --ubaTaeCJ
-1 OR 3+697-697-1=0+0+0+1 --ubaTaeCJ
-1 OR 3*2<(0+5+697-697) --ubaTaeCJ
-1 OR 3*2>(0+5+697-697) --ubaTaeCJ
-1 OR 2+240-240-1=0+0+0+1ubaTaeCJ
-1 OR 3+240-240-1=0+0+0+1ubaTaeCJ
-1 OR 3*2<(0+5+240-240)ubaTaeCJ
-1 OR 3*2>(0+5+240-240)ubaTaeCJ
-1' OR 2+575-575-1=0+0+0+1 --ubaTaeCJ
-1' OR 3+575-575-1=0+0+0+1 --ubaTaeCJ
-1' OR 3*2<(0+5+575-575) --ubaTaeCJ
-1' OR 3*2>(0+5+575-575) --ubaTaeCJ
-1' OR 2+214-214-1=0+0+0+1 or '917rsky8'='ubaTaeCJ
-1' OR 3+214-214-1=0+0+0+1 or '917rsky8'='ubaTaeCJ
-1' OR 3*2<(0+5+214-214) or '917rsky8'='ubaTaeCJ
-1' OR 3*2>(0+5+214-214) or '917rsky8'='ubaTaeCJ
-1" OR 2+107-107-1=0+0+0+1 --ubaTaeCJ
-1" OR 3+107-107-1=0+0+0+1 --ubaTaeCJ
-1" OR 3*2<(0+5+107-107) --ubaTaeCJ
-1" OR 3*2>(0+5+107-107) --ubaTaeCJ
if(now()=sysdate(),sleep(15),0)ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'ZubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"ZubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/ubaTaeCJ
-1; waitfor delay '0:0:15' --ubaTaeCJ
-1); waitfor delay '0:0:15' --ubaTaeCJ
1 waitfor delay '0:0:15' --ubaTaeCJ
wkhnsK63'; waitfor delay '0:0:15' --ubaTaeCJ
-5 OR 776=(SELECT 776 FROM PG_SLEEP(15))--ubaTaeCJ
-5) OR 308=(SELECT 308 FROM PG_SLEEP(15))--ubaTaeCJ
-1)) OR 565=(SELECT 565 FROM PG_SLEEP(15))--ubaTaeCJ
m6fXk5jv' OR 946=(SELECT 946 FROM PG_SLEEP(15))--ubaTaeCJ
nmJbvDfB') OR 284=(SELECT 284 FROM PG_SLEEP(15))--ubaTaeCJ
OUMfqFtH')) OR 978=(SELECT 978 FROM PG_SLEEP(15))--ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'ubaTaeCJ
1'"ubaTaeCJ
@@QMMVMRelated Programs
- list input in python
- sum of list in python | without using built-in function
- Average of list in python | without using built-in function
- linear search in python
- largest element in the list python | without using built-in function
- smallest element in the list python | without using built-in function
- Print all the numbers which are less than given key element from a given list.
- delete element in list python
- Revese the elements in list python
- Reverse the first half of list elements in python
- Reverse the second half of list elements in python
- list sort python
- list sort descending order python
- Python Program to sort half of the list elements in ascending order and next half in descending order.
- merging two lists in python
- circular list rotation in python
coming Soon
coming Soon