human
Write me a code to largest number in the Array having frequency same as value and the other steps required given the following:
Largest number in the Array having frequency same as value | Function to find the largest number whose frequency is equal to itself ..
Find the maximum element in the array.
Driver code"
Solution in Python:
assistant
#Here is code to largest number in the Array having frequency same as value and the other steps required.
 def findLargestNumber ( arr ) :
	k = max ( arr ) ;
	m = [ 0 ] * ( k + 1 ) ;
	for n in arr :
		m [ n ] += 1 ;
	for n in range ( len ( arr ) - 1 , 0 , - 1 ) :
		if ( n == m [ n ] ) :
			return n ;
	return - 1 ;
if __name__ == ' _ _ main _ _ ' :
	arr = [ 3 , 2 , 5 , 2 , 4 , 5 ] ;
	print ( findLargestNumber ( arr ) ) ;