Write a Python function to find the single number which occurs odd numbers and other numbers occur even number.


Topic: Write a Python function to find the single number which occurs odd numbers and other numbers occur even number.

Solution

def odd_occurrence(arr):
 
    # Initialize result
    result = 0
     
    # Traverse the array
    for element in arr:
        # XOR
        result = result ^ element
 
    return result



List all Python Programs