human
Number of elements that can be seen from right side | Python3 program to find number of elements that can be seen from right side.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to number of elements that can be seen from right side and the other steps required.
 def numberOfElements ( height , n ) :
	max_so_far = 0
	coun = 0
	for i in range ( n - 1 , - 1 , - 1 ) :
		if height [ i ] > max_so_far :
			max_so_far = height [ i ]
			coun = coun + 1
	return coun
if __name__ == ' _ _ main _ _ ' :
	n = 6
	height = [ 4 , 8 , 2 , 0 , 0 , 5 ]
	print ( numberOfElements ( height , n ) )