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

				
			
					
			
				
			

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] = max1

Tech Events

Hackathon