human
Find a pair ( n , r ) in an integer array such that value of nPr is maximum | Function to print the pair ( n , r ) such that nPr is maximum possible.
There should be atleast 2 elements.
Findex the largest 2 elements.
Driver code"
How can the above be solved in Python?

Give me a code to find a pair ( n , r ) in an integer array such that value of nPr is maximum and the other steps required?
assistant
#Here is code to find a pair ( n , r ) in an integer array such that value of nPr is maximum and the other steps required.
 def findPair ( arr , n ) :
	if ( n < 2 ) :
		print ( " - 1" )
		return
	i = 0
	first = - 1
	second = - 1
	for i in range ( n ) :
		if ( arr [ i ] > first ) :
			second = first
			first = arr [ i ]
		elif ( arr [ i ] > second ) :
			second = arr [ i ]
	print ( " n ▁ = " , first , " and ▁ r ▁ = " , second )
arr = [ 0 , 2 , 3 , 4 , 1 , 6 , 8 , 9 ]
n = len ( arr )
findPair ( arr , n )