gauriiighadge / HactoberFest2023

HactoberFest2023
https://github.com/gauriiighadge/HactoberFest2023
MIT License
21 stars 401 forks source link

Find_Odd_Occurance_XOR.cpp #262

Open ADARSH-863 opened 8 months ago

ADARSH-863 commented 8 months ago

This C++ program finds the number with an odd occurrence in an array using the bitwise XOR operator. By XORing all elements in the array, the program effectively cancels out pairs of the same numbers, leaving behind the element with an odd occurrence. This bitwise operation enables a compact and efficient solution for identifying the number that occurs an odd number of times in the array.