human
Find the Number Occurring Odd Number of Times | function to find the element occurring odd number of times.
Putting all elements into the HashMap.
Iterate through HashMap to check an element occurring odd number of times and return it.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find the Number Occurring Odd Number of Times and the other steps required.
 def getOddOccurrence ( arr , size ) :
	Hash = dict ( )
	for i in range ( size ) :
		Hash [ arr [ i ] ] = Hash . get ( arr [ i ] , 0 ) + 1 ;
	for i in Hash :
		if ( Hash [ i ] % 2 != 0 ) :
			return i
	return - 1
arr = [ 2 , 3 , 5 , 4 , 5 , 2 , 4 , 3 , 5 , 2 , 4 , 4 , 2 ]
n = len ( arr )
print ( getOddOccurrence ( arr , n ) )